mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 17:15:57 +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
fead145f8b
commit
a683c939b5
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