Bug005: fix remotesw null pointer exception.
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 6fc6d62..3df8bb8 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -524,7 +524,8 @@
     	IOFSwitch remotesw = null;
     	
     	// add a switch if we have not seen it before
-        if (!remoteSwitches.containsKey(sw)) {
+    	remotesw = remoteSwitches.get(sw);
+        if (remotesw == null) {
         	remotesw = new OFSwitchImpl();
         	remotesw.setupRemoteSwitch(sw);
         	remoteSwitches.put(remotesw.getId(), remotesw);