From: Emden R. Gansner Date: Tue, 12 Aug 2014 18:45:44 +0000 (-0400) Subject: Fix case for curved edges when centroid is identical to the midpoint of an edge X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~175 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=489f1a73936c7d0069defe6c23371ed4727644b1;p=graphviz Fix case for curved edges when centroid is identical to the midpoint of an edge --- diff --git a/lib/common/routespl.c b/lib/common/routespl.c index 3a2d5b84e..c0e500a02 100644 --- a/lib/common/routespl.c +++ b/lib/common/routespl.c @@ -918,6 +918,7 @@ static void bend(pointf spl[4], pointf centroid) double vX = centroid.x - midpt.x; double vY = centroid.y - midpt.y; double magV = sqrt(vX*vX + vY*vY); + if (magV == 0) return; /* if midpoint == centroid, don't divide by zero */ a.x = midpt.x - vX / magV * r; /* + would be closest point */ a.y = midpt.y - vY / magV * r; }