be failsafe on updates

This commit is contained in:
yugecin 2016-09-27 22:04:14 +02:00
parent 52aac61233
commit 730f55ce20

View File

@ -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];
}