Code

Fix g_return_if_fail failure: It can validly happen that fit_canvas_to_selection...
authorpjrm <pjrm@users.sourceforge.net>
Thu, 11 Oct 2007 12:21:05 +0000 (12:21 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Thu, 11 Oct 2007 12:21:05 +0000 (12:21 +0000)
src/selection-chemistry.cpp

index ec4f096dd4164290f04695316f792e412ee5c0c6..0aa884f56f7de50e7be67a065e7eb05f7d0b8f94 100644 (file)
@@ -3002,8 +3002,11 @@ void fit_canvas_to_selection(SPDesktop *desktop) {
 
     g_return_if_fail(doc != NULL);
     g_return_if_fail(desktop->selection != NULL);
-    g_return_if_fail(!desktop->selection->isEmpty());
 
+    if (desktop->selection->isEmpty()) {
+        desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to fit canvas to."));
+        return;
+    }
     NR::Maybe<NR::Rect> const bbox(desktop->selection->bounds());
     if (bbox && !bbox->isEmpty()) {
         doc->fitToRect(*bbox);