From 4705c841a919e911d3cdc0575b9f7b194f64d448 Mon Sep 17 00:00:00 2001 From: Johannes Dewender Date: Tue, 18 Mar 2014 17:38:21 +0100 Subject: [PATCH] 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. --- lib/common/postproc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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++; } } -- 2.40.0