]> granicus.if.org Git - graphviz/commitdiff
Fix bug in agnxtedge; the agnxtin branch wasn't checking for NULL return.
authorerg <devnull@localhost>
Mon, 30 Mar 2009 17:31:42 +0000 (17:31 +0000)
committererg <devnull@localhost>
Mon, 30 Mar 2009 17:31:42 +0000 (17:31 +0000)
lib/cgraph/edge.c

index 127cedab8d9f36eac53a9ee94ff60d9d84116d4f..55450305f3a1017bb048ec9b298ff5012a48c5e0 100644 (file)
@@ -91,15 +91,15 @@ Agedge_t *agnxtedge(Agraph_t * g, Agedge_t * e, Agnode_t * n)
 {
     Agedge_t *rv;
 
-       if (AGTYPE(e) == AGOUTEDGE) {
-               rv = agnxtout(g, e);
-               if (rv == NILedge)
-                       rv = agfstin(g, n);
+    if (AGTYPE(e) == AGOUTEDGE) {
+       rv = agnxtout(g, e);
+       if (rv == NILedge)
+           rv = agfstin(g, n);
     } else {
-               do {
-                       rv = agnxtin(g, e);             /* so that we only see each edge once, */
-               } while (rv->node == n);        /* ignore loops as in-edges */
-       }
+       do {
+           rv = agnxtin(g, e);         /* so that we only see each edge once, */
+       } while (rv && (rv->node == n));        /* ignore loops as in-edges */
+    }
     return rv;
 }