Fix crash on calling play() in a uninitialized AnimatedSprite2D
When AnimatedSprite2D::play() was called before SpriteFrames has been initialized, a crach occurred (issue #46013).
Modification : An error message on null check test has been added to prevent crash.
Fix #46013.
(cherry picked from commit 324ab63844
)
This commit is contained in:
parent
e8d0089901
commit
ae8019a7f6
1 changed files with 1 additions and 1 deletions
|
@ -605,7 +605,7 @@ 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) {
|
||||
|
|
Loading…
Reference in a new issue