Re-allow playing AnimatedSprite2D without frames

Fixes #47578, partial revert of #47064.

(cherry picked from commit 77264e346b)
This commit is contained in:
Rémi Verschelde 2021-04-05 14:40:44 +02:00
parent 79f4da78fb
commit 822b734601
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 2 deletions

View File

@ -605,12 +605,11 @@ bool AnimatedSprite::_is_playing() const {
}
void AnimatedSprite::play(const StringName &p_animation, const bool p_backwards) {
ERR_FAIL_COND_MSG(!frames.is_valid(), "Can't play AnimatedSprite without a valid SpriteFrames resource.");
backwards = p_backwards;
if (p_animation) {
set_animation(p_animation);
if (backwards && get_frame() == 0)
if (frames.is_valid() && backwards && get_frame() == 0)
set_frame(frames->get_frame_count(p_animation) - 1);
}