onos-6310:- avoid Null pointer in protocol TL1Controller method disconnectDevice

Change-Id: I1e6cd1c7b63747978b1acb95bd56af40538e89bf
diff --git a/protocols/tl1/ctl/src/main/java/org/onosproject/tl1/impl/DefaultTl1Controller.java b/protocols/tl1/ctl/src/main/java/org/onosproject/tl1/impl/DefaultTl1Controller.java
index 7a2fa8f..118c43f 100644
--- a/protocols/tl1/ctl/src/main/java/org/onosproject/tl1/impl/DefaultTl1Controller.java
+++ b/protocols/tl1/ctl/src/main/java/org/onosproject/tl1/impl/DefaultTl1Controller.java
@@ -211,9 +211,9 @@
         Channel channel = device.channel();
         if (channel != null) {
             channel.close();
+            msgMap.remove(channel);
         }
 
-        msgMap.remove(channel);
         device.disconnect();
         tl1Listeners.forEach(l -> l.deviceDisconnected(deviceId));
     }