diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-24 15:09:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 15:09:28 +0100 |
commit | 2ffecb76ed1d90d4b7eaa6bbeafdddf628d5f7e9 (patch) | |
tree | e5f7246a75d0b76499dd63baba908723a613ec5c | |
parent | 829b6ef27b08ce0eea45f691de4e5bb2a1335a8f (diff) | |
parent | 5b2100d85c6b021ffe019552e5664719aed094e9 (diff) |
Merge pull request #45438 from Norrox/fixtweennullcheck
Fix the tween null check
-rw-r--r-- | scene/animation/tween.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 62d03ea80c..9b98f3d031 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -1350,6 +1350,9 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant return; } + // Check that the target object is valid + ERR_FAIL_COND_MSG(p_object == nullptr, vformat("The Tween \"%s\"'s target node is `null`. Is the node reference correct?", get_name())); + // Get the property from the node path p_property = p_property.get_as_property_path(); @@ -1378,6 +1381,9 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ return; } + // Check that the target object is valid + ERR_FAIL_COND_MSG(p_object == nullptr, vformat("The Tween \"%s\"'s target node is `null`. Is the node reference correct?", get_name())); + // Convert any integers into REALs as they are better for interpolation if (p_initial_val.get_type() == Variant::INT) { p_initial_val = p_initial_val.operator real_t(); |