From 740648de49c9b41c9f83b3d1a8a31383c18327ff Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 19 Oct 2024 20:37:18 +0500 Subject: fix: IndexOutOfBoundsException --- core/src/kz/ilotterytea/maxon/player/DecalPlayer.java | 8 ++++++-- 1 file 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() { -- cgit v1.2.3