From ddc6177836028eca89fb701ad2e5e923cb94ae87 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 7 Dec 2015 21:18:04 +0100 Subject: static code analysis (bzr r14508) --- src/widgets/toolbox.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index c3f301c52..b75cdb4be 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -943,8 +943,12 @@ static Glib::RefPtr create_or_fetch_actions( SPDesktop* deskto }; Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small"); - Glib::RefPtr mainActions; + if (desktop == NULL) + { + return mainActions; + } + if ( groups.find(desktop) != groups.end() ) { mainActions = groups[desktop]; } @@ -952,10 +956,7 @@ static Glib::RefPtr create_or_fetch_actions( SPDesktop* deskto if ( !mainActions ) { mainActions = Gtk::ActionGroup::create("main"); groups[desktop] = mainActions; - if (desktop) - { - desktop->connectDestroy(&desktopDestructHandler); - } + desktop->connectDestroy(&desktopDestructHandler); } for ( guint i = 0; i < G_N_ELEMENTS(verbsToUse); i++ ) { @@ -1558,13 +1559,12 @@ static void toggle_snap_callback(GtkToggleAction *act, gpointer data) //data poi SPDesktop *dt = reinterpret_cast(ptr); SPNamedView *nv = dt->getNamedView(); - SPDocument *doc = nv->document; - - if (dt == NULL || nv == NULL) { - g_warning("No desktop or namedview specified (in toggle_snap_callback)!"); + if (nv == NULL) { + g_warning("No namedview specified (in toggle_snap_callback)!"); return; } + SPDocument *doc = nv->document; Inkscape::XML::Node *repr = nv->getRepr(); if (repr == NULL) { -- cgit v1.2.3