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:
Jinny You 2024-03-27 22:10:18 +09:00 committed by Hermet Park
parent 925009c4a5
commit ca7b59876a

View file

@ -42,7 +42,10 @@ static char* _int2str(int num)
CompositeMethod LottieParser::getMaskMethod(bool inversed)
{
switch (getString()[0]) {
auto mode = getString();
if (!mode) return CompositeMethod::None;
switch (mode[0]) {
case 'a': {
if (inversed) return CompositeMethod::InvAlphaMask;
else return CompositeMethod::AddMask;