summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-10-12 12:16:05 +0000
committertavmjong-free <tavmjong@free.fr>2014-10-12 12:16:05 +0000
commit17cb730370ab87bdb323c1e6972d09fe75b59f5a (patch)
tree799c20e33f961fb9bc9bf018adffa466b5d8172d /src
parentFix "Access to field 'image_out' results in a dereference of a null pointer" (diff)
downloadinkscape-17cb730370ab87bdb323c1e6972d09fe75b59f5a.tar.gz
inkscape-17cb730370ab87bdb323c1e6972d09fe75b59f5a.zip
Fix "Access to field 'image_out' results in a dereference of a null pointer"
(bzr r13596)
Diffstat (limited to 'src')
-rw-r--r--src/filters/composite.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp
index 257292f12..e600b6d20 100644
--- a/src/filters/composite.cpp
+++ b/src/filters/composite.cpp
@@ -205,6 +205,8 @@ void SPFeComposite::update(SPCtx *ctx, guint flags) {
/* Unlike normal in, in2 is required attribute. Make sure, we can call
* it by some name. */
+ /* This may not be true.... see issue at
+ * http://www.w3.org/TR/filter-effects/#feBlendElement (but it doesn't hurt). */
if (this->in2 == Inkscape::Filters::NR_FILTER_SLOT_NOT_SET ||
this->in2 == Inkscape::Filters::NR_FILTER_UNNAMED_SLOT)
{
@@ -228,26 +230,30 @@ Inkscape::XML::Node* SPFeComposite::write(Inkscape::XML::Document *doc, Inkscape
repr = doc->createElement("svg:feComposite");
}
- gchar const *out_name = sp_filter_name_for_image(parent, this->in2);
+ gchar const *in2_name = sp_filter_name_for_image(parent, this->in2);
- if (out_name) {
- repr->setAttribute("in2", out_name);
- } else {
+ if( !in2_name ) {
+
+ // This code is very similar to sp_filter_primitive_name_previous_out()
SPObject *i = parent->children;
+ // Find previous filter primitive
while (i && i->next != this) {
i = i->next;
}
- SPFilterPrimitive *i_prim = SP_FILTER_PRIMITIVE(i);
- out_name = sp_filter_name_for_image(parent, i_prim->image_out);
- repr->setAttribute("in2", out_name);
-
- if (!out_name) {
- g_warning("Unable to set in2 for feComposite");
+ if( i ) {
+ SPFilterPrimitive *i_prim = SP_FILTER_PRIMITIVE(i);
+ in2_name = sp_filter_name_for_image(parent, i_prim->image_out);
}
}
+ if (in2_name) {
+ repr->setAttribute("in2", in2_name);
+ } else {
+ g_warning("Unable to set in2 for feComposite");
+ }
+
char const *comp_op;
switch (this->composite_operator) {