Browse Source

Merge pull request #52925 from timothyqiu/follow-property-null

Rémi Verschelde 3 years ago
parent
commit
23bb5883cb
1 changed files with 4 additions and 4 deletions
  1. 4 4
      scene/animation/tween.cpp

+ 4 - 4
scene/animation/tween.cpp

@@ -1554,6 +1554,10 @@ bool Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
 		return true;
 		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
 	// Get the two properties from their paths
 	p_property = p_property.get_as_property_path();
 	p_property = p_property.get_as_property_path();
 	p_target_property = p_target_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();
 		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
 	// No negative durations
 	ERR_FAIL_COND_V(p_duration < 0, false);
 	ERR_FAIL_COND_V(p_duration < 0, false);