Code

copyedit
[inkscape.git] / src / sp-conn-end.cpp
index 7c0d9650615c7cae9045bcb76c0f0cad29952bd6..3840daf97487d1cf5ecf16544896689503b8a4c5 100644 (file)
@@ -34,7 +34,7 @@ get_nearest_common_ancestor(SPObject const *const obj, SPItem const *const objs[
 }
 
 static void
-sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
+sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
                             SPPath *const path,
                             bool const updatePathRepr = true)
 {
@@ -64,15 +64,21 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
         /* Initial end-points: centre of attached object. */
         NR::Point h2endPt_icoordsys[2];
         NR::Matrix h2i2anc[2];
-        NR::Rect h2bbox_icoordsys[2] = {
-            h2attItem[0]->getBounds(NR::identity()),
-            h2attItem[1]->getBounds(NR::identity())
-        };
+        NR::Rect h2bbox_icoordsys[2];
         NR::Point last_seg_endPt[2] = {
             sp_curve_second_point(path->curve),
             sp_curve_penultimate_point(path->curve)
         };
         for (unsigned h = 0; h < 2; ++h) {
+            NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(NR::identity());
+            if (!bbox) {
+                if (updatePathRepr) {
+                    path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+                    path->updateRepr();
+                }
+                return;
+            }
+            h2bbox_icoordsys[h] = *bbox;
             h2i2anc[h] = i2anc_affine(h2attItem[h], ancestor);
             h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint();
         }
@@ -107,8 +113,16 @@ sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
 
         NR::Rect otherpt_rect = NR::Rect(other_endpt, other_endpt);
         NR::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect };
-        h2bbox_icoordsys[ind] = h2attItem[ind]->getBounds(NR::identity());
+        NR::Maybe<NR::Rect> bbox = h2attItem[ind]->getBounds(NR::identity());
+        if (!bbox) {
+            if (updatePathRepr) {
+                path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+                path->updateRepr();
+            }
+            return;
+        }
 
+        h2bbox_icoordsys[ind] = *bbox;
         h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
         h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
 
@@ -263,7 +277,7 @@ SPConnEnd::setAttacherHref(gchar const *value)
 }
 
 void
-sp_conn_end_href_changed(SPObject *old_ref, SPObject *ref,
+sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
                          SPConnEnd *connEndPtr, SPPath *const path, unsigned const handle_ix)
 {
     g_return_if_fail(connEndPtr != NULL);