Code

Don't crash on broken references when resolving ID clashes.
authorsasilver <sasilver@users.sourceforge.net>
Tue, 15 Jul 2008 13:06:51 +0000 (13:06 +0000)
committersasilver <sasilver@users.sourceforge.net>
Tue, 15 Jul 2008 13:06:51 +0000 (13:06 +0000)
src/id-clash.cpp

index 1ce30e0ddf67f6ae11dd6d5a1ff98df8cad2a418..5980c9e7b2eebfabede7b087c0b30400095a9a22 100644 (file)
@@ -125,19 +125,25 @@ find_references(SPObject *elem, refmap_type *refmap)
     for (unsigned i = 0; i < NUM_SPIPAINT_PROPERTIES; ++i) {
         const SPIPaint SPStyle::*prop = SPIPaint_members[i];
         const SPIPaint *paint = &(style->*prop);
-        if (paint->isPaintserver()) {
-            const gchar *id = SP_OBJECT_ID(paint->value.href->getObject());
-            IdReference idref = { REF_STYLE, elem, SPIPaint_properties[i] };
-            (*refmap)[id].push_back(idref);
+        if (paint->isPaintserver() && paint->value.href) {
+            const SPObject *obj = paint->value.href->getObject();
+            if (obj) {
+                const gchar *id = SP_OBJECT_ID(obj);
+                IdReference idref = { REF_STYLE, elem, SPIPaint_properties[i] };
+                (*refmap)[id].push_back(idref);
+            }
         }
     }
 
     /* check for url(#...) references in 'filter' */
     const SPIFilter *filter = &(style->filter);
     if (filter->href) {
-        const gchar *id = SP_OBJECT_ID(filter->href->getObject());
-        IdReference idref = { REF_STYLE, elem, "filter" };
-        (*refmap)[id].push_back(idref);
+        const SPObject *obj = filter->href->getObject();
+        if (obj) {
+            const gchar *id = SP_OBJECT_ID(obj);
+            IdReference idref = { REF_STYLE, elem, "filter" };
+            (*refmap)[id].push_back(idref);
+        }
     }
 
     /* check for other url(#...) references */