]> granicus.if.org Git - graphviz/commitdiff
return 0 instead of crash on agnxtsubg(g) when g is a root graph
authorStephen North <north@research.att.com>
Mon, 31 Oct 2011 17:20:00 +0000 (13:20 -0400)
committerStephen North <north@research.att.com>
Mon, 31 Oct 2011 17:20:00 +0000 (13:20 -0400)
lib/cgraph/subg.c

index 3f9c84de1374542688a642a8f58b14235431c3a7..da4ceb17dc92300855289a97d60e3fd894b26449 100644 (file)
@@ -76,7 +76,7 @@ Agraph_t *agnxtsubg(Agraph_t * subg)
     Agraph_t *g;
 
     g = agparent(subg);
-    return (Agraph_t *) dtnext(g->g_dict, subg);
+    return g? (Agraph_t *) dtnext(g->g_dict, subg) : 0;
 }
 
 Agraph_t *agparent(Agraph_t * g)