Browse Source

Merge pull request #24489 from mateusfccp/18264_wrong_animation_error

Make AnimatedSprite.animation complain when invalid animation name
Hein-Pieter van Braam 6 years ago
parent
commit
5c28296efe
1 changed files with 3 additions and 0 deletions
  1. 3 0
      scene/2d/animated_sprite.cpp

+ 3 - 0
scene/2d/animated_sprite.cpp

@@ -645,6 +645,9 @@ void AnimatedSprite::_reset_timeout() {
 
 
 void AnimatedSprite::set_animation(const StringName &p_animation) {
 void AnimatedSprite::set_animation(const StringName &p_animation) {
 
 
+	ERR_EXPLAIN(vformat("There is no animation with name '%s'.", p_animation));
+	ERR_FAIL_COND(frames->get_animation_names().find(p_animation) == -1);
+
 	if (animation == p_animation)
 	if (animation == p_animation)
 		return;
 		return;