From d6874813055914ea7d37faf8a697efde7582d67d Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Sat, 6 Jun 2009 22:12:17 +0000 Subject: [PATCH] Don't crash when closing document with gradient tool being active (fixes bug #380934) --- src/desktop-style.cpp | 6 +++++- src/gradient-context.cpp | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index edb925135..d5144e9f0 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -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; } /** diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 643b63f79..b4eeda290 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -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()) -- 2.30.2