Code

Don't try displaying markers for completely empty paths, fixes crash.
[inkscape.git] / src / splivarot.cpp
index db9f729752a26d29071ca1a328c6f70a8144db77..e273ca82f196d1e5f4831317fc15425e84cfe5d6 100644 (file)
@@ -626,8 +626,7 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Matrix
 
 static
 void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker_transform,
-                              Geom::Scale stroke_scale, Geom::Matrix transform,
-                              Geom::PathVector* pathv_in )
+                              Geom::Scale stroke_scale, Geom::PathVector* pathv_in )
 {
     SPMarker* marker = SP_MARKER (marker_object);
     SPItem* marker_item = sp_item_first_item_child(SP_OBJECT(marker_object));
@@ -637,7 +636,7 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Matrix marker
         tr = stroke_scale * tr;
     }
     // total marker transform
-    tr = marker_item->transform * marker->c2p * tr * transform;
+    tr = marker_item->transform * marker->c2p * tr;
 
     Geom::PathVector* marker_pathv = item_outline(marker_item);
     
@@ -675,6 +674,10 @@ Geom::PathVector* item_outline(SPItem const *item)
         return ret_pathv;
     }
 
+    if (curve->get_pathvector().empty()) {
+        return ret_pathv;
+    }
+
     // remember old stroke style, to be set on fill
     SPStyle *i_style = SP_OBJECT_STYLE(item);
 
@@ -792,7 +795,7 @@ Geom::PathVector* item_outline(SPItem const *item)
                 if ( SPObject *marker_obj = shape->marker[i] ) {
                     Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.front().front()));
                     item_outline_add_marker( marker_obj, m,
-                                             Geom::Scale(i_style->stroke_width.computed), transform,
+                                             Geom::Scale(i_style->stroke_width.computed),
                                              ret_pathv );
                 }
             }
@@ -807,7 +810,7 @@ Geom::PathVector* item_outline(SPItem const *item)
                     {
                         Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front()));
                         item_outline_add_marker( midmarker_obj, m,
-                                                 Geom::Scale(i_style->stroke_width.computed), transform,
+                                                 Geom::Scale(i_style->stroke_width.computed),
                                                  ret_pathv );
                     }
                     // MID position
@@ -822,7 +825,7 @@ Geom::PathVector* item_outline(SPItem const *item)
                              */
                             Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2));
                             item_outline_add_marker( midmarker_obj, m,
-                                                     Geom::Scale(i_style->stroke_width.computed), transform,
+                                                     Geom::Scale(i_style->stroke_width.computed),
                                                      ret_pathv);
 
                             ++curve_it1;
@@ -834,7 +837,7 @@ Geom::PathVector* item_outline(SPItem const *item)
                         Geom::Curve const &lastcurve = path_it->back_default();
                         Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve);
                         item_outline_add_marker( midmarker_obj, m,
-                                                 Geom::Scale(i_style->stroke_width.computed), transform,
+                                                 Geom::Scale(i_style->stroke_width.computed),
                                                  ret_pathv );
                     }
                 }
@@ -853,7 +856,7 @@ Geom::PathVector* item_outline(SPItem const *item)
 
                     Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve);
                     item_outline_add_marker( marker_obj, m,
-                                             Geom::Scale(i_style->stroke_width.computed), transform,
+                                             Geom::Scale(i_style->stroke_width.computed),
                                              ret_pathv );
                 }
             }
@@ -901,6 +904,10 @@ sp_selected_path_outline(SPDesktop *desktop)
                 continue;
         }
 
+        if (curve->get_pathvector().empty()) {
+            continue;
+        }
+
         // pas de stroke pas de chocolat
         if (!SP_OBJECT_STYLE(item) || SP_OBJECT_STYLE(item)->stroke.noneSet) {
             curve->unref();