[dia] path: fix matherr caused by wrong bezpoint access



commit c513ad10e330d36faba2204a434b382eacd9d930
Author: Hans Breuer <hans breuer org>
Date:   Sun Jul 21 13:23:13 2013 +0200

    path: fix matherr caused by wrong bezpoint access
    
    bp.p3 is only initialized for BEZ_CURVE_TO

 lib/diapathrenderer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/diapathrenderer.c b/lib/diapathrenderer.c
index 04380df..5d8401c 100644
--- a/lib/diapathrenderer.c
+++ b/lib/diapathrenderer.c
@@ -498,7 +498,8 @@ _bezier (DiaRenderer *self,
   /* get rid of the first move-to if we can attach to the previous point */
   if (path->len > 0) {
     BezPoint *bp = &g_array_index (path, BezPoint, path->len-1);
-    if (distance_point_point(&bp->p3, &points[0].p1) < 0.001)
+    Point *pt = (BEZ_CURVE_TO == bp->type) ? &bp->p3 : &bp->p1;
+    if (distance_point_point(pt, &points[0].p1) < 0.001)
       i = 1;
   }
   for (i; i < numpoints; ++i)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]