diff options
author | jmb462 <jmb462@gmail.com> | 2021-03-16 17:28:16 +0100 |
---|---|---|
committer | jmb462 <jmb462@gmail.com> | 2021-03-17 14:57:04 +0100 |
commit | 324ab63844e2c42024e9fb7f8fdde234330f1bad (patch) | |
tree | b74f077b6a1b7ba4fc34bb4a780f6b418ac96dc9 /scene | |
parent | bc7e105821cc1a7b1173bc997aa61b3f5b58430a (diff) |
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.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/animated_sprite_2d.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 359044a576..dfc08583f2 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -382,6 +382,7 @@ bool AnimatedSprite2D::_is_playing() const { } 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; if (p_animation) { |