mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
SvgLoader: Prevent underflow when stack.cnt is 0
If graphic node is directly located in the <svg>(root) node, it may cause underflow because stack.cnt is 0.
This commit is contained in:
parent
7aff026276
commit
c15103e033
1 changed files with 2 additions and 1 deletions
|
@ -1963,7 +1963,8 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
|
|||
loader->stack.push(node);
|
||||
}
|
||||
} else if ((method = _findGraphicsFactory(tagName))) {
|
||||
parent = loader->stack.list[loader->stack.cnt - 1];
|
||||
if (loader->stack.cnt > 0) parent = loader->stack.list[loader->stack.cnt - 1];
|
||||
else parent = loader->doc;
|
||||
node = method(loader, parent, attrs, attrsLength);
|
||||
} else if ((gradientMethod = _findGradientFactory(tagName))) {
|
||||
SvgStyleGradient* gradient;
|
||||
|
|
Loading…
Add table
Reference in a new issue