From 1ebe1aa7b5f8091750049dac7ed1e44c31a6618c Mon Sep 17 00:00:00 2001 From: Nicholas Guriev Date: Thu, 27 May 2021 15:01:58 +0300 Subject: [PATCH] Fix dereferencing of null pointer in model::Layer::solidColor() getter Also remove unnecessarily check of mExtra->mAsset in the asset() getter. Change-Id: Ic17532314309e331be28bd09d9af63208ac0690b --- src/lottie/lottiemodel.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index 977e808..c6b8cf6 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -687,7 +687,10 @@ public: int inFrame() const noexcept { return mInFrame; } int outFrame() const noexcept { return mOutFrame; } int startFrame() const noexcept { return mStartFrame; } - Color solidColor() const noexcept { return mExtra->mSolidColor; } + Color solidColor() const noexcept + { + return mExtra ? mExtra->mSolidColor : Color(); + } bool autoOrient() const noexcept { return mAutoOrient; } int timeRemap(int frameNo) const; VSize layerSize() const { return mLayerSize; } @@ -701,10 +704,7 @@ public: { return mTransform ? mTransform->opacity(frameNo) : 1.0f; } - Asset *asset() const - { - return (mExtra && mExtra->mAsset) ? mExtra->mAsset : nullptr; - } + Asset *asset() const { return mExtra ? mExtra->mAsset : nullptr; } struct Extra { Color mSolidColor; std::string mPreCompRefId; -- 2.34.1