From 6971fea62834130d8f6afb1d872990f028268a6c Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Thu, 11 Oct 2007 12:21:05 +0000 Subject: 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. (bzr r3873) --- src/selection-chemistry.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3