summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-02-28 14:24:51 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-13 21:45:34 +0100
commit4e90cc55ecf379a7cfe426fa7263cc604220b644 (patch)
tree3ec817ced2e60c8515fe349284382ea8650911f9 /scene/animation
parent925381201be45a19e27a7093410033acb214f97c (diff)
Check for type mismatch in PropertyTweener.from()
(cherry picked from commit 45f4d59fa477d6e22adb02432449e0fda10ac5d2)
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/tween.cpp5
-rw-r--r--scene/animation/tween.h2
2 files changed, 7 insertions, 0 deletions
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> 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,