From: Johannes Dewender Date: Tue, 18 Mar 2014 16:38:21 +0000 (+0100) Subject: postproc: fix crash on unpositioned edge X-Git-Tag: 2.38.0~21^2~1^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4705c841a919e911d3cdc0575b9f7b194f64d448;p=graphviz postproc: fix crash on unpositioned edge There seem to be cases where edges don't get a position in the layout. Not sure where this bug is exactly, but we should give a warning, rather than crash completely. --- diff --git a/lib/common/postproc.c b/lib/common/postproc.c index 163bf30e4..0a57f7649 100644 --- a/lib/common/postproc.c +++ b/lib/common/postproc.c @@ -503,6 +503,11 @@ static void addXLabels(Agraph_t * gp) addXLabel (lp, objp, xlp, 1, edgeMidpoint(gp, ep)); xlp++; } + else { + agerr(AGWARN, "no position for edge with label %s", + ED_label(ep)->text); + continue; + } objp++; } if ((lp = ED_tail_label(ep))) { @@ -513,6 +518,11 @@ static void addXLabels(Agraph_t * gp) addXLabel (lp, objp, xlp, 1, edgeTailpoint(ep)); xlp++; } + else { + agerr(AGWARN, "no position for edge with tail label %s", + ED_tail_label(ep)->text); + continue; + } objp++; } if ((lp = ED_head_label(ep))) { @@ -523,6 +533,11 @@ static void addXLabels(Agraph_t * gp) addXLabel (lp, objp, xlp, 1, edgeHeadpoint(ep)); xlp++; } + else { + agerr(AGWARN, "no position for edge with head label %s", + ED_head_label(ep)->text); + continue; + } objp++; } if ((lp = ED_xlabel(ep))) { @@ -533,6 +548,11 @@ static void addXLabels(Agraph_t * gp) addXLabel (lp, objp, xlp, 1, edgeMidpoint(gp, ep)); xlp++; } + else { + agerr(AGWARN, "no position for edge with xlabel %s", + ED_xlabel(ep)->text); + continue; + } objp++; } }