summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/kz/ilotterytea/maxon/ui/AnimatedImage.java9
1 files changed, 6 insertions, 3 deletions
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++;
}