diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 9d1118e0ef2..e05c24ae09b 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 c5abcb28a6e..b7dc941111f 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,