From 4e90cc55ecf379a7cfe426fa7263cc604220b644 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 28 Feb 2023 14:24:51 +0100 Subject: Check for type mismatch in PropertyTweener.from() (cherry picked from commit 45f4d59fa477d6e22adb02432449e0fda10ac5d2) --- scene/animation/tween.cpp | 5 +++++ scene/animation/tween.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 9d1118e0ef..e05c24ae09 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -489,6 +489,11 @@ Tween::Tween(bool p_valid) { } Ref PropertyTweener::from(Variant p_value) { + ERR_FAIL_COND_V(tween.is_null(), nullptr); + if (!tween->_validate_type_match(p_value, final_val)) { + return nullptr; + } + initial_val = p_value; do_continue = false; return this; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index c5abcb28a6..b7dc941111 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -61,6 +61,8 @@ class MethodTweener; class Tween : public RefCounted { GDCLASS(Tween, RefCounted); + friend class PropertyTweener; + public: enum TweenProcessMode { TWEEN_PROCESS_PHYSICS, -- cgit v1.2.3