Code

Fix Bug #675309 - crash when unlinking an orphaned clone
[inkscape.git] / src / sp-use.cpp
index 7962390c24304cf214f04cc40d14ce04a55127ae..ecb7eb788b137c69537c43312d9950e96ce06518 100644 (file)
@@ -288,7 +288,14 @@ sp_use_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, uns
                              * Geom::Translate(use->x.computed,
                                                use->y.computed)
                              * transform );
-        sp_item_invoke_bbox_full(child, bbox, ct, flags, FALSE);
+        Geom::OptRect optbbox;
+        sp_item_invoke_bbox_full(child, optbbox, ct, flags, FALSE);
+        if (optbbox) {
+            bbox->x0 = (*optbbox)[0][0];
+            bbox->y0 = (*optbbox)[1][0];
+            bbox->x1 = (*optbbox)[0][1];
+            bbox->y1 = (*optbbox)[1][1];
+        }
     }
 }
 
@@ -671,7 +678,7 @@ sp_use_unlink(SPUse *use)
 
     // Track the ultimate source of a chain of uses.
     SPItem *orig = sp_use_root(use);
-    g_return_val_if_fail(orig, NULL);
+    if (!orig) return NULL ;
 
     // Calculate the accumulated transform, starting from the original.
     Geom::Matrix t = sp_use_get_root_transform(use);