Null pointer exception for non-existent switch
diff --git a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
index e727238..fe758cd 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
@@ -281,7 +281,8 @@
 		
 		String dpidStr = HexString.toHexString(dpid);
 
-		LeaderLatch latch = switches.get(dpidStr).getLatch();
+		
+		LeaderLatch latch = (switches.get(dpidStr) != null)?switches.get(dpidStr).getLatch():null;
 		
 		if (latch == null){
 			log.warn("Tried to get controller for non-existent switch");