From 652139c0ae237603d324f13b97a874a80098ca6c Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sun, 11 Feb 2007 02:00:45 +0000 Subject: [PATCH] fix 1654495: a comment repr node has no spobject, so we must weaken the asserts --- src/sp-object.cpp | 5 +++-- src/sp-root.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 9294a2e9f..9b6c24917 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -737,8 +737,9 @@ sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) { debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); SPObject *ochild = sp_object_get_child_by_repr(object, child); - g_return_if_fail(ochild != NULL); - sp_object_detach(object, ochild); + g_return_if_fail (ochild != NULL || !strcmp("comment", child->name())); // comments have no objects + if (ochild) + sp_object_detach(object, ochild); } /** diff --git a/src/sp-root.cpp b/src/sp-root.cpp index d6e423edc..c555c78a0 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -353,9 +353,9 @@ sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML: (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref); SPObject *co = object->document->getObjectByRepr(child); - g_assert(co != NULL); + g_assert (co != NULL || !strcmp("comment", child->name())); // comment repr node has no object - if (SP_IS_DEFS(co)) { + if (co && SP_IS_DEFS(co)) { SPObject *c; /* We search for first node - it is not beautiful, but works */ for (c = sp_object_first_child(SP_OBJECT(group)) ; c != NULL; c = SP_OBJECT_NEXT(c) ) { -- 2.30.2