mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
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:
parent
ff96d4bf2b
commit
7aff026276
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue