]> granicus.if.org Git - graphviz/commitdiff
postproc: fix crash on unpositioned edge
authorJohannes Dewender <github@JonnyJD.net>
Tue, 18 Mar 2014 16:38:21 +0000 (17:38 +0100)
committerJohannes Dewender <github@JonnyJD.net>
Tue, 18 Mar 2014 18:13:39 +0000 (19:13 +0100)
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

index 163bf30e4107c08ac257d2e28c467960614d69c2..0a57f76492c87fc25d49909ffccdb59e9e1ef6b8 100644 (file)
@@ -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++;
            }
        }