summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorPeter Moulder <peter.moulder@monash.edu>2007-10-11 12:21:05 +0000
committerpjrm <pjrm@users.sourceforge.net>2007-10-11 12:21:05 +0000
commit6971fea62834130d8f6afb1d872990f028268a6c (patch)
tree495913007c791df18be9d8ff1bf8253e27abb5de /src/selection-chemistry.cpp
parentadded icon theme specification to the GTK theme Inkscape uses on OS X. I use ... (diff)
downloadinkscape-6971fea62834130d8f6afb1d872990f028268a6c.tar.gz
inkscape-6971fea62834130d8f6afb1d872990f028268a6c.zip
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)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp5
1 files changed, 4 insertions, 1 deletions
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 <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);