mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie/expressions: ++safety
Prevent segfault in case of the omitted name json data
This commit is contained in:
parent
dfa05a5c43
commit
ecd4fb8a70
1 changed files with 10 additions and 6 deletions
|
@ -315,9 +315,11 @@ static void _buildLayer(jerry_value_t context, float frameNo, LottieLayer* layer
|
|||
//marker.nearestKey(t)
|
||||
//marker.numKeys
|
||||
|
||||
if (layer->name) {
|
||||
auto name = jerry_string_sz(layer->name);
|
||||
jerry_object_set_sz(context, EXP_NAME, name);
|
||||
jerry_value_free(name);
|
||||
}
|
||||
|
||||
auto toComp = jerry_function_external(_toComp);
|
||||
jerry_object_set_sz(context, "toComp", toComp);
|
||||
|
@ -1276,9 +1278,11 @@ void LottieExpressions::buildComp(LottieComposition* comp, float frameNo, Lottie
|
|||
//bgColor
|
||||
//pixelAspect
|
||||
|
||||
if (comp->name) {
|
||||
auto name = jerry_string((jerry_char_t*)comp->name, strlen(comp->name), JERRY_ENCODING_UTF8);
|
||||
jerry_object_set_sz(thisComp, EXP_NAME, name);
|
||||
jerry_value_free(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue