summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation/script.cpp
diff options
context:
space:
mode:
authorTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
committerTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
commitdb85d12f8c106586a0b11f60bf32cdb8ca75d8f2 (patch)
treeae5cbc2ad4fdbb93dbc1d7fc8b92ee2e2012e853 /src/extension/implementation/script.cpp
parentrenamed SPPattern methods to match coding style (diff)
parentfix crash introduces by recent rev when clipping (diff)
downloadinkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.tar.gz
inkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.zip
merged trunk
(bzr r14059.1.21)
Diffstat (limited to 'src/extension/implementation/script.cpp')
-rw-r--r--src/extension/implementation/script.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 5cab3a2b2..e07a3963c 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -812,6 +812,12 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr
}
}
+ if(!oldroot_namedview)
+ {
+ g_warning("Error on copy_doc: No namedview on destination document.");
+ return;
+ }
+
// Unparent (delete)
for (unsigned int i = 0; i < delete_list.size(); i++) {
sp_repr_unparent(delete_list[i]);
@@ -823,12 +829,10 @@ void Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newr
child = child->next()) {
if (!strcmp("sodipodi:namedview", child->name())) {
newroot_namedview = child;
- if (oldroot_namedview != NULL) {
- for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild();
- newroot_namedview_child != NULL;
- newroot_namedview_child = newroot_namedview_child->next()) {
- oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document()));
- }
+ for (Inkscape::XML::Node * newroot_namedview_child = child->firstChild();
+ newroot_namedview_child != NULL;
+ newroot_namedview_child = newroot_namedview_child->next()) {
+ oldroot_namedview->appendChild(newroot_namedview_child->duplicate(oldroot->document()));
}
} else {
oldroot->appendChild(child->duplicate(oldroot->document()));