summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2009-01-01 07:32:49 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2009-01-01 07:32:49 +0000
commit1ffa7a4dc206e33086cc6ee15c15f32ac35fbdba (patch)
treedb0f85d01b495ae9df9739019cb9577188531199 /src
parentfix crash when ungrouping a group with set-then-unset filter (diff)
downloadinkscape-1ffa7a4dc206e33086cc6ee15c15f32ac35fbdba.tar.gz
inkscape-1ffa7a4dc206e33086cc6ee15c15f32ac35fbdba.zip
fix crash when assigning a non-parseable preset filter
(bzr r7051)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/filter/filter.cpp9
1 files 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);
}