SvgLoader: Add null check

Since the pointer actually used inside the if condition is loader->def,
add a null check for this.
This commit is contained in:
JunsuChoi 2020-09-04 13:56:24 +09:00 committed by Hermet Park
parent 6768e11eed
commit c27a952f44

View file

@ -1974,7 +1974,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
// But finally, the loader has a gradient style list regardless of defs.
// This is only to support this when multiple gradients are declared, even if no defs are declared.
// refer to: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs
if (loader->doc->node.doc.defs) {
if (loader->def && loader->doc->node.doc.defs) {
loader->def->node.defs.gradients.push(gradient);
} else {
loader->gradients.push(gradient);