diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-19 20:37:18 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-19 20:37:18 +0500 |
| commit | 740648de49c9b41c9f83b3d1a8a31383c18327ff (patch) | |
| tree | f1e64b2d567a3e9515bf271b2d246f9afa2a623e | |
| parent | d9d19bf1fd95da5256179d22305dcffad6701e9c (diff) | |
fix: IndexOutOfBoundsException
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/player/DecalPlayer.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/kz/ilotterytea/maxon/player/DecalPlayer.java b/core/src/kz/ilotterytea/maxon/player/DecalPlayer.java index d7cb680..8f4e601 100644 --- a/core/src/kz/ilotterytea/maxon/player/DecalPlayer.java +++ b/core/src/kz/ilotterytea/maxon/player/DecalPlayer.java @@ -68,12 +68,16 @@ public class DecalPlayer { private void updateTextureRegion() { this.regionIndex++; + TextureRegion region; - if (this.regions.get(this.regionIndex) == null) { + try { + region = this.regions.get(this.regionIndex); + } catch (Exception ignored) { this.regionIndex = 0; + region = this.regions.get(regionIndex); } - this.decal.setTextureRegion(this.regions.get(this.regionIndex)); + this.decal.setTextureRegion(region); } public Decal getDecal() { |
