Code

don't crash upon adding strange named XML element to namedview.
authorjohanengelen <johanengelen@users.sourceforge.net>
Tue, 4 Dec 2007 23:53:07 +0000 (23:53 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Tue, 4 Dec 2007 23:53:07 +0000 (23:53 +0000)
src/sp-namedview.cpp

index 03cc4bdadea08fb80755622656dd0dbc137e23da..a26d1ce0e0fbb47e912f51ed87fc51c1576b9a32 100644 (file)
@@ -513,9 +513,10 @@ static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *chil
     const gchar *id = child->attribute("id");
     if (!strcmp(child->name(), "inkscape:grid")) {
         sp_namedview_add_grid(nv, child, NULL);
-    } else {
+    } else if (id) {
         SPObject *no = object->document->getObjectById(id);
-        g_assert(SP_IS_OBJECT(no));
+        if ( !SP_IS_OBJECT(no) )
+            return;
 
         if (SP_IS_GUIDE(no)) {
             SPGuide *g = (SPGuide *) no;