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.
This commit is contained in:
parent
bc7e105821
commit
324ab63844
|
@ -382,6 +382,7 @@ bool AnimatedSprite2D::_is_playing() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) {
|
void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) {
|
||||||
|
ERR_FAIL_NULL_MSG(frames, "Can't play AnimatedSprite2D without a valid SpriteFrames resource.");
|
||||||
backwards = p_backwards;
|
backwards = p_backwards;
|
||||||
|
|
||||||
if (p_animation) {
|
if (p_animation) {
|
||||||
|
|
Loading…
Reference in New Issue