diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 9be1938211523068f94f202188c29205cd0fa793..f3bb22a2882e9612937040dd16a839ab5719f84c 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -478,6 +478,7 @@ IFloodlightModule, IInfoProvider, IHAListener {
         // Send standard LLDPs
         for (long sw: switches) {
             IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
+            if (iofSwitch == null) continue;
             if (iofSwitch.getEnabledPorts() != null) {
                 for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) {
                     // sends only forward LLDPs and BDDPs
@@ -488,6 +489,7 @@ IFloodlightModule, IInfoProvider, IHAListener {
 
         for (long sw: switches) {
             IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
+            if (iofSwitch == null) continue;
             if (iofSwitch.getEnabledPorts() != null) {
                 for (OFPhysicalPort p : iofSwitch.getEnabledPorts()) {
                     // sends only forward LLDPs and BDDPs