From 00ff1644e9c7620080664fd591051161af98bea4 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 9 Jun 2024 15:25:14 +0500 Subject: fix: catch arrayindexoutofboundsexception --- core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/src/kz/ilotterytea/maxon/ui') diff --git a/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java b/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java index 097fb2b..19ec0dc 100644 --- a/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java +++ b/core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java @@ -22,9 +22,12 @@ public class AnimatedImage extends Image implements Disposable { if (index > regions.length - 1) { index = 0; } - if (regions[index + 1] == null) { - index = 0; - } + try { + if (regions[index + 1] == null) { + index = 0; + } + } catch (ArrayIndexOutOfBoundsException ignored) {} + super.setDrawable(new TextureRegionDrawable(regions[index])); index++; } -- cgit v1.2.3