From 730f55ce20ef4a629d10e55548e89629b889caea Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 27 Sep 2016 22:04:14 +0200 Subject: [PATCH] be failsafe on updates --- src/yugecin/opsudance/Dancer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index 02104a1a..b3da2eb4 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -81,6 +81,9 @@ public class Dancer { } public void setSpinnerIndex(int spinnerIndex) { + if (spinnerIndex < 0 || spinnerIndex >= spinners.length) { + spinnerIndex = 0; + } this.spinnerIndex = spinnerIndex; spinner = spinners[spinnerIndex]; } @@ -90,6 +93,9 @@ public class Dancer { } public void setMoverFactoryIndex(int moverFactoryIndex) { + if (moverFactoryIndex < 0 || moverFactoryIndex >= moverFactories.length) { + moverFactoryIndex = 0; + } this.moverFactoryIndex = moverFactoryIndex; moverFactory = moverFactories[moverFactoryIndex]; }