From 7a06e9bbf8db6c7d814af48b994163f8434e1e22 Mon Sep 17 00:00:00 2001 From: Jinny You Date: Wed, 5 Jun 2024 19:54:29 +0900 Subject: [PATCH] lottie: Add exception for lottie doesn't have exported glyph Added handling logic for missing characters to prevent program hang. --- src/loaders/lottie/tvgLottieBuilder.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 401ceb08..9dd8a6fa 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -1099,6 +1099,7 @@ static void _updateText(LottieLayer* layer, float frameNo) cursor.y = ++line * (doc.height / scale); } //find the glyph + bool found = false; for (auto g = text->font->chars.begin(); g < text->font->chars.end(); ++g) { auto glyph = *g; //draw matched glyphs @@ -1128,9 +1129,13 @@ static void _updateText(LottieLayer* layer, float frameNo) //advance the cursor position horizontally cursor.x += glyph->width + spacing + doc.tracking; + + found = true; break; } } + + if (!found) ++p; } }