Eliminate extra getVertices() call
diff --git a/src/main/java/net/onrc/onos/graph/GraphDBOperation.java b/src/main/java/net/onrc/onos/graph/GraphDBOperation.java
index 03b4c96..0b5c9c6 100644
--- a/src/main/java/net/onrc/onos/graph/GraphDBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/GraphDBOperation.java
@@ -61,10 +61,10 @@
 	public ISwitchObject searchSwitch(String dpid) {
 
 		FramedGraph<TitanGraph> fg = conn.getFramedGraph();
-		
-		return (fg != null && fg.getVertices("dpid",dpid).iterator().hasNext()) ? 
-				fg.getVertices("dpid",dpid,ISwitchObject.class).iterator().next() : null;
-				
+		if ( fg == null ) return null;
+		Iterator<ISwitchObject> it = fg.getVertices("dpid",dpid,ISwitchObject.class).iterator();
+		return (it.hasNext()) ? it.next() : null;
+
 	}
 
 	/**