SvgLoader: Defs type nodes are not saved in loader's node list.

If there is an empty (unused) <defs /> inside the svg file, this can cause problems.
<defs> node is managed separately in loader->def.
So it doesn't have to be added to loader's list.
This commit is contained in:
JunsuChoi 2020-09-02 16:05:06 +09:00 committed by Hermet Park
parent ff96d4bf2b
commit 7aff026276

View file

@ -1955,11 +1955,12 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
if (loader->stack.cnt > 0) parent = loader->stack.list[loader->stack.cnt - 1];
node = method(loader, parent, attrs, attrsLength);
}
loader->stack.push(node);
if (node->type == SvgNodeType::Defs) {
loader->doc->node.doc.defs = node;
loader->def = node;
} else {
loader->stack.push(node);
}
} else if ((method = _findGraphicsFactory(tagName))) {
parent = loader->stack.list[loader->stack.cnt - 1];
@ -2389,4 +2390,4 @@ unique_ptr<Scene> SvgLoader::data()
if (task) task->get();
if (root) return move(root);
else return nullptr;
}
}