Merge pull request #74112 from KoBeWi/from_mismatch_to_match

Check for type mismatch in `PropertyTweener.from()`
This commit is contained in:
Rémi Verschelde 2023-03-03 11:04:57 +01:00
commit dbd76cd1f6
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 7 additions and 0 deletions

View File

@ -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;

View File

@ -61,6 +61,8 @@ class MethodTweener;
class Tween : public RefCounted {
GDCLASS(Tween, RefCounted);
friend class PropertyTweener;
public:
enum TweenProcessMode {
TWEEN_PROCESS_PHYSICS,