From 0cb49af80c6054253355d16cab0ace6eadcf7cc5 Mon Sep 17 00:00:00 2001 From: pjrm Date: Thu, 11 Oct 2007 12:21:05 +0000 Subject: [PATCH] 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. --- 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); -- 2.30.2