mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
svg_loader: handle the exception properly.
viewBox doesn't expect the missing attributes, it won't have any default values. So we can decide the fault when the values are missed.
This commit is contained in:
parent
c214532ad2
commit
bdda2586e9
1 changed files with 2 additions and 7 deletions
|
@ -1143,13 +1143,8 @@ static bool _attrParseSymbolNode(void* data, const char* key, const char* value)
|
|||
SvgSymbolNode* symbol = &(node->node.symbol);
|
||||
|
||||
if (!strcmp(key, "viewBox")) {
|
||||
if (_parseNumber(&value, &symbol->vx)) {
|
||||
if (_parseNumber(&value, &symbol->vy)) {
|
||||
if (_parseNumber(&value, &symbol->vw)) {
|
||||
_parseNumber(&value, &symbol->vh);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!_parseNumber(&value, &symbol->vx) || !_parseNumber(&value, &symbol->vy)) return false;
|
||||
if (!_parseNumber(&value, &symbol->vw) || !_parseNumber(&value, &symbol->vh)) return false;
|
||||
} else if (!strcmp(key, "width")) {
|
||||
symbol->w = _toFloat(loader->svgParse, value, SvgParserLengthType::Horizontal);
|
||||
} else if (!strcmp(key, "height")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue