Code

Eliminate remaining sources of empty NR::Rects
[inkscape.git] / src / display / sp-canvas.cpp
index 75ffeed846cb82c530a7133d855be596c36e8e0d..559515e037773df3ad107cae6b2996a378f40b38 100644 (file)
@@ -744,11 +744,16 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
         }
     }
 
-    NR::Rect const &bounds = corners.bounds();
-    item->x1 = bounds.min()[NR::X];
-    item->y1 = bounds.min()[NR::Y];
-    item->x2 = bounds.max()[NR::X];
-    item->y2 = bounds.max()[NR::Y];
+    NR::Maybe<NR::Rect> const bounds = corners.bounds();
+    if (bounds) {
+        item->x1 = bounds->min()[NR::X];
+        item->y1 = bounds->min()[NR::Y];
+        item->x2 = bounds->max()[NR::X];
+        item->y2 = bounds->max()[NR::Y];
+    } else {
+        item->x1 = item->x2 = corners.midpoint()[NR::X];
+        item->y1 = item->y2 = corners.midpoint()[NR::Y];
+    }
 }
 
 /**