Avoid access to last element of empty mChildren vector
authorNicholas Guriev <nicholas@guriev.su>
Fri, 21 May 2021 19:36:10 +0000 (22:36 +0300)
committerHermet Park <chuneon.park@samsung.com>
Mon, 21 Jun 2021 02:53:59 +0000 (11:53 +0900)
Change-Id: I590b2bdf25424161d25ddc1a4311b393d08b9a96

src/lottie/lottieparser.cpp

index 6d46cc28f1396d1a1287a0d26657a92e8c2c42f7..70a132f636c3e8006a0e9fdf8c2e3e0c7e0d16d5 100644 (file)
@@ -1225,8 +1225,9 @@ model::Object *LottieParserImpl::parseGroupObject()
             while (NextArrayValue()) {
                 parseObject(group);
             }
-            if (group->mChildren.back()->type() ==
-                model::Object::Type::Transform) {
+            if (!group->mChildren.empty()
+                    && group->mChildren.back()->type()
+                            == model::Object::Type::Transform) {
                 group->mTransform =
                     static_cast<model::Transform *>(group->mChildren.back());
                 group->mChildren.pop_back();