mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie: Fix crash from invalid masking method
This change is better for stability. Returns `None` if the `mode` attribute cannot be parsed. related issue: #2072
This commit is contained in:
parent
925009c4a5
commit
ca7b59876a
1 changed files with 4 additions and 1 deletions
|
@ -42,7 +42,10 @@ static char* _int2str(int num)
|
||||||
|
|
||||||
CompositeMethod LottieParser::getMaskMethod(bool inversed)
|
CompositeMethod LottieParser::getMaskMethod(bool inversed)
|
||||||
{
|
{
|
||||||
switch (getString()[0]) {
|
auto mode = getString();
|
||||||
|
if (!mode) return CompositeMethod::None;
|
||||||
|
|
||||||
|
switch (mode[0]) {
|
||||||
case 'a': {
|
case 'a': {
|
||||||
if (inversed) return CompositeMethod::InvAlphaMask;
|
if (inversed) return CompositeMethod::InvAlphaMask;
|
||||||
else return CompositeMethod::AddMask;
|
else return CompositeMethod::AddMask;
|
||||||
|
|
Loading…
Add table
Reference in a new issue