]> granicus.if.org Git - graphviz/commitdiff
Add patch from Stefan Kost, so that if triangulation fails, the
authorerg <devnull@localhost>
Fri, 14 Jan 2011 22:40:02 +0000 (22:40 +0000)
committererg <devnull@localhost>
Fri, 14 Jan 2011 22:40:02 +0000 (22:40 +0000)
code doesn't abort but uses a line segment.

lib/pathplan/shortest.c

index 1da98f7eafce63ba18c76dae54c02f714915e869..84a9f25e3c750e3c9cf7b418ec36ef42b0ee1ded 100644 (file)
@@ -199,7 +199,12 @@ int Pshortestpath(Ppoly_t * polyp, Ppoint_t * eps, Ppolyline_t * output)
     /* mark the strip of triangles from eps[0] to eps[1] */
     if (!marktripath(ftrii, ltrii)) {
        prerror("cannot find triangle path");
-       abort();
+       /* a straight line is better than failing */
+       growops(2);
+       output->pn = 2;
+       ops[0] = eps[0], ops[1] = eps[1];
+       output->ps = ops;
+       return 0;
     }
 
     /* if endpoints in same triangle, use a single line */
@@ -310,7 +315,7 @@ static void triangulate(pointnlink_t ** pnlps, int pnln)
                                return;
                        }
                }
-               abort();
+               prerror("triangulation failed");
     } 
        else
                loadtriangle(pnlps[0], pnlps[1], pnlps[2]);