Don't try and write an empty list of OF messages

Change-Id: Ic18971cd0b4b019906d2bdcbe9aef627f79065f7
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
index 24a51b6..3b38f48 100644
--- a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
@@ -327,7 +327,7 @@
         this.agent.transitionToMasterSwitch(dpid);
         synchronized (messagesPendingMastership) {
             List<OFMessage> messages = messagesPendingMastership.get();
-            if (messages != null) {
+            if (messages != null && !messages.isEmpty()) {
                 // Cannot use sendMsg here. It will only append to pending list.
                 sendMsgsOnChannel(messages);
                 log.debug("Sending {} pending messages to switch {}",