mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 03:54:25 +00:00
svg_loader: fixing segf when passing a nullptr to strcmp
This occurred when a gradient has no 'id' attribute.
This commit is contained in:
parent
0925aa84a5
commit
470b885e65
1 changed files with 2 additions and 2 deletions
|
@ -2874,7 +2874,7 @@ static SvgStyleGradient* _gradientDup(Array<SvgStyleGradient*>* gradients, const
|
|||
auto gradList = gradients->data;
|
||||
|
||||
for (uint32_t i = 0; i < gradients->count; ++i) {
|
||||
if (!strcmp((*gradList)->id, id)) {
|
||||
if ((*gradList)->id && !strcmp((*gradList)->id, id)) {
|
||||
result = _cloneGradient(*gradList);
|
||||
break;
|
||||
}
|
||||
|
@ -2884,7 +2884,7 @@ static SvgStyleGradient* _gradientDup(Array<SvgStyleGradient*>* gradients, const
|
|||
if (result && result->ref) {
|
||||
gradList = gradients->data;
|
||||
for (uint32_t i = 0; i < gradients->count; ++i) {
|
||||
if (!strcmp((*gradList)->id, result->ref)) {
|
||||
if ((*gradList)->id && !strcmp((*gradList)->id, result->ref)) {
|
||||
if (result->stops.count == 0) _cloneGradStops(result->stops, (*gradList)->stops);
|
||||
//TODO: Properly inherit other property
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue