From: pjrm Date: Thu, 11 Oct 2007 12:21:05 +0000 (+0000) Subject: Fix g_return_if_fail failure: It can validly happen that fit_canvas_to_selection... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0cb49af80c6054253355d16cab0ace6eadcf7cc5;p=inkscape.git Fix g_return_if_fail failure: It can validly happen that fit_canvas_to_selection is called when nothing is selected (just like many other verbs). So put new message in status bar and return rather than signalling an error with g_return_if_fail. --- diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index ec4f096dd..0aa884f56 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -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 object(s) to fit canvas to.")); + return; + } NR::Maybe const bbox(desktop->selection->bounds()); if (bbox && !bbox->isEmpty()) { doc->fitToRect(*bbox);