Code

Richard's patch for crash bug 402274
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 4 Oct 2009 15:42:39 +0000 (15:42 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 4 Oct 2009 15:42:39 +0000 (15:42 +0000)
src/text-editing.cpp

index 5b9db13d4532a29c2926344b9f5e0322133afa45..2bdee4c102a643ff8302d7142fd8c8113a35cadc 100644 (file)
@@ -1547,8 +1547,9 @@ static bool redundant_double_nesting_processor(SPObject **item, SPObject *child,
     if (!objects_have_equal_style(SP_OBJECT_PARENT(*item), child)) return false;
 
     Inkscape::XML::Node *insert_after_repr;
-    if (prepend) insert_after_repr = SP_OBJECT_REPR(SP_OBJECT_PREV(*item));
-    else insert_after_repr = SP_OBJECT_REPR(*item);
+    if (!prepend) insert_after_repr = SP_OBJECT_REPR(*item);
+    else if (SP_OBJECT_PREV(*item)) insert_after_repr = SP_OBJECT_REPR(SP_OBJECT_PREV(*item));
+    else insert_after_repr = NULL;
     while (SP_OBJECT_REPR(child)->childCount()) {
         Inkscape::XML::Node *move_repr = SP_OBJECT_REPR(child)->firstChild();
         Inkscape::GC::anchor(move_repr);