From: erg Date: Mon, 30 Mar 2009 17:31:42 +0000 (+0000) Subject: Fix bug in agnxtedge; the agnxtin branch wasn't checking for NULL return. X-Git-Tag: LAST_LIBGRAPH~32^2~2222 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6790a828a237b265f08700848ae1fcaa05b5e00a;p=graphviz Fix bug in agnxtedge; the agnxtin branch wasn't checking for NULL return. --- diff --git a/lib/cgraph/edge.c b/lib/cgraph/edge.c index 127cedab8..55450305f 100644 --- a/lib/cgraph/edge.c +++ b/lib/cgraph/edge.c @@ -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; }