summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-08-01 09:14:20 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-08-01 09:14:20 +0000
commitd75d9a6b3f33a3d901b8bc0d1d37b0f6af8d2766 (patch)
tree576bee88dd9ef9b9695c0b1ef710e00e6a113e04 /src/document.cpp
parentMerge lp:~inkscape.dev/inkscape/bendFromClipboard into lp:inkscape (diff)
downloadinkscape-d75d9a6b3f33a3d901b8bc0d1d37b0f6af8d2766.tar.gz
inkscape-d75d9a6b3f33a3d901b8bc0d1d37b0f6af8d2766.zip
fix for 1478636 (crash on import when comments in defs)
Fixed bugs: - https://launchpad.net/bugs/1478636 (bzr r14270)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/document.cpp b/src/document.cpp
index ebf5d312f..2ea969910 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1640,7 +1640,7 @@ void SPDocument::importDefs(SPDocument *source)
prevent_id_clashes(source, this);
for (std::vector<Inkscape::XML::Node const *>::iterator defs = defsNodes.begin(); defs != defsNodes.end(); ++defs) {
- importDefsNode(source, const_cast<Inkscape::XML::Node *>(*defs), target_defs);
+ importDefsNode(source, const_cast<Inkscape::XML::Node *>(*defs), target_defs);
}
}
@@ -1688,11 +1688,10 @@ void SPDocument::importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, I
/* First pass: remove duplicates in clipboard of definitions in document */
for (Inkscape::XML::Node *def = defs->firstChild() ; def ; def = def->next()) {
-
+ if(def->type() != Inkscape::XML::ELEMENT_NODE)continue;
/* If this clipboard has been pasted into one document, and is now being pasted into another,
or pasted again into the same, it will already have been processed. If we detect that then
skip the rest of this pass. */
-
Glib::ustring defid = def->attribute("id");
if( defid.find( DuplicateDefString ) != Glib::ustring::npos )break;
@@ -1722,6 +1721,7 @@ void SPDocument::importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, I
/* Second pass: remove duplicates in clipboard of earlier definitions in clipboard */
for (Inkscape::XML::Node *def = defs->firstChild() ; def ; def = def->next()) {
+ if(def->type() != Inkscape::XML::ELEMENT_NODE)continue;
Glib::ustring defid = def->attribute("id");
if( defid.find( DuplicateDefString ) != Glib::ustring::npos )continue; // this one already handled
SPObject *src = source->getObjectByRepr(def);
@@ -1749,6 +1749,7 @@ void SPDocument::importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, I
/* Final pass: copy over those parts which are not duplicates */
for (Inkscape::XML::Node *def = defs->firstChild() ; def ; def = def->next()) {
+ if(def->type() != Inkscape::XML::ELEMENT_NODE)continue;
/* Ignore duplicate defs marked in the first pass */
Glib::ustring defid = def->attribute("id");