fix: Check for bindableProperty nullptr in TransitionViewModelCondition (#11653) aa788cab46 Co-authored-by: Philip Chung <philterdesign@gmail.com>
diff --git a/.rive_head b/.rive_head index 5d10c63..bb099fd 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -c0ee8aa205463c65eb307d080491ae05e1df8538 +aa788cab462e8de4438e619a4047c7e6e39fcabb
diff --git a/include/rive/animation/transition_property_viewmodel_comparator.hpp b/include/rive/animation/transition_property_viewmodel_comparator.hpp index 2df3702..0043c50 100644 --- a/include/rive/animation/transition_property_viewmodel_comparator.hpp +++ b/include/rive/animation/transition_property_viewmodel_comparator.hpp
@@ -32,7 +32,7 @@ BindableProperty* bindableProperty() { return m_bindableProperty; } protected: - BindableProperty* m_bindableProperty; + BindableProperty* m_bindableProperty = nullptr; }; } // namespace rive
diff --git a/src/animation/transition_viewmodel_condition.cpp b/src/animation/transition_viewmodel_condition.cpp index 5b29cc4..77eb304 100644 --- a/src/animation/transition_viewmodel_condition.cpp +++ b/src/animation/transition_viewmodel_condition.cpp
@@ -285,6 +285,11 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + m_comparison = new ConditionComparisonNone(); + return; + } if (rightBindableProperty->is<BindablePropertyNumber>()) { auto leftComparand = @@ -328,6 +333,11 @@ leftComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (leftBindableProperty == nullptr) + { + m_comparison = new ConditionComparisonNone(); + return; + } if (rightComparator()->is<TransitionSelfComparator>()) { m_comparison = new ConditionComparisonSelf(leftBindableProperty); @@ -344,6 +354,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyNumber>()) { auto leftComparand = @@ -404,6 +418,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyBoolean>()) { auto leftComparand = @@ -446,6 +464,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyString>()) { auto leftComparand = @@ -488,6 +510,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyColor>()) { auto leftComparand = @@ -530,6 +556,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyEnum>()) { auto leftComparand = new ConditionComparandEnumBindable( @@ -567,6 +597,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyTrigger>()) { auto leftComparand = @@ -602,6 +636,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyInteger>()) { auto leftComparand = @@ -663,6 +701,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyAsset>()) { auto leftComparand = @@ -705,6 +747,10 @@ rightComparator() ->as<TransitionPropertyViewModelComparator>() ->bindableProperty(); + if (rightBindableProperty == nullptr) + { + break; + } if (rightBindableProperty->is<BindablePropertyArtboard>()) { auto leftComparand =