lottie: ++stability

ensure that the loading has been completed before overriding.
This commit is contained in:
Hermet Park 2024-04-15 22:09:41 +09:00 committed by Hermet Park
parent 3de7580d96
commit 0268e9e3d1

View file

@ -262,7 +262,8 @@ bool LottieLoader::read()
Paint* LottieLoader::paint() Paint* LottieLoader::paint()
{ {
this->done(); done();
if (!comp) return nullptr; if (!comp) return nullptr;
comp->initiated = true; comp->initiated = true;
return comp->root->scene; return comp->root->scene;
@ -271,6 +272,8 @@ Paint* LottieLoader::paint()
bool LottieLoader::override(const char* slot) bool LottieLoader::override(const char* slot)
{ {
if (!comp) done();
if (!comp || comp->slots.count == 0) return false; if (!comp || comp->slots.count == 0) return false;
auto success = true; auto success = true;