From e8db78b6cd0851e7515e05cf357f21cf9582e34b Mon Sep 17 00:00:00 2001 From: buliabyak Date: Thu, 1 Jan 2009 07:32:49 +0000 Subject: [PATCH] fix crash when assigning a non-parseable preset filter --- src/extension/internal/filter/filter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 5a104b6a1..048207332 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -117,6 +117,11 @@ Filter::merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Ink void Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * docCache) { + Inkscape::XML::Document *filterdoc = get_filter(module); + if (filterdoc == NULL) { + return; // could not parse the XML source of the filter; typically parser will stderr a warning + } + //printf("Calling filter effect\n"); Inkscape::Selection * selection = ((SPDesktop *)document)->selection; @@ -143,7 +148,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d Glib::ustring url = "url(#"; url += newfilterroot->attribute("id"); url += ")"; - merge_filters(newfilterroot, get_filter(module)->root(), xmldoc); + merge_filters(newfilterroot, filterdoc->root(), xmldoc); Inkscape::GC::release(newfilterroot); @@ -177,7 +182,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d alpha->setAttribute("values", "0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"); filternode->appendChild(alpha); - merge_filters(filternode, get_filter(module)->root(), xmldoc, FILTER_SRC_GRAPHIC, FILTER_SRC_GRAPHIC_ALPHA); + merge_filters(filternode, filterdoc->root(), xmldoc, FILTER_SRC_GRAPHIC, FILTER_SRC_GRAPHIC_ALPHA); Inkscape::GC::release(alpha); } -- 2.30.2