Code

Don't crash when closing document with gradient tool being active (fixes bug #380934)
authordvlierop2 <dvlierop2@users.sourceforge.net>
Sat, 6 Jun 2009 22:12:17 +0000 (22:12 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Sat, 6 Jun 2009 22:12:17 +0000 (22:12 +0000)
src/desktop-style.cpp
src/gradient-context.cpp

index edb925135b3169f97079d08a3be358a3a5199abc..d5144e9f02864221af25f972350b344f754cdfad 100644 (file)
@@ -1324,7 +1324,11 @@ sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property)
         return ret; // subselection returned a style, pass it on
 
     // otherwise, do querying and averaging over selection
-    return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
+    if (desktop->selection != NULL) {
+       return sp_desktop_query_style_from_list ((GSList *) desktop->selection->itemList(), style, property);
+    }
+
+    return QUERY_STYLE_NOTHING;
 }
 
 /**
index 643b63f794dcf90f5ca7603bc97fd04a6b440269..b4eeda2905dde99800d7be3e2f392454fc372758 100644 (file)
@@ -147,6 +147,9 @@ gradient_selection_changed (Inkscape::Selection *, gpointer data)
 
     GrDrag *drag = rc->_grdrag;
     Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(rc)->desktop);
+    if (selection == NULL) {
+       return;
+    }
     guint n_obj = g_slist_length((GSList *) selection->itemList());
 
     if (!drag->isNonEmpty() || selection->isEmpty())