Fix crash in Tween.follow_property
Check `p_object` for null before using it.
This commit is contained in:
parent
dd0ee48728
commit
45b4304f10
1 changed files with 4 additions and 4 deletions
|
@ -1554,6 +1554,10 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
|
|||
return true;
|
||||
}
|
||||
|
||||
// Confirm the source and target objects are valid
|
||||
ERR_FAIL_NULL_V(p_object, false);
|
||||
ERR_FAIL_NULL_V(p_target, false);
|
||||
|
||||
// Get the two properties from their paths
|
||||
p_property = p_property.get_as_property_path();
|
||||
p_target_property = p_target_property.get_as_property_path();
|
||||
|
@ -1569,10 +1573,6 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
|
|||
p_initial_val = p_initial_val.operator real_t();
|
||||
}
|
||||
|
||||
// Confirm the source and target objects are valid
|
||||
ERR_FAIL_COND_V(p_object == nullptr, false);
|
||||
ERR_FAIL_COND_V(p_target == nullptr, false);
|
||||
|
||||
// No negative durations
|
||||
ERR_FAIL_COND_V(p_duration < 0, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue