Merge branch 'master' of github.com:OPENNETWORKINGLAB/ONOS
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");
diff --git a/web/add_flow.py b/web/add_flow.py
index 9b5ab42..56b305a 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -44,12 +44,13 @@
   try:
     command = "curl -s http://%s:%s/wm/topology/route/%s/%s/%s/%s/json" % (ControllerIP, ControllerPort, v1, p1, v2, p2)
     debug("shortest_path %s" % command)
+    parsedResult = []
 
     result = os.popen(command).read()
     debug("result %s" % result)
     if len(result) == 0:
 	log_error("No Path found")
-	exit(1);
+	return parsedResult
 
     parsedResult = json.loads(result)
     debug("parsed %s" % parsedResult)
@@ -431,8 +432,9 @@
     if data_path != last_data_path:
       if len(last_data_path) > 0:
 	delete_flow_path(my_flow_id)
-      flow_path = compute_flow_path(parsed_args, data_path)
-      add_flow_path(flow_path)
+      if len(data_path) > 0:
+	flow_path = compute_flow_path(parsed_args, data_path)
+	add_flow_path(flow_path)
       last_data_path = data_path
 
     if MonitoringEnabled != True: