Fixed a crash when switching spells (#839)

Switching spells causes ArrayIndexOutOfBoundsException: -1 when the next spell is empty.I made a simple fix
This commit is contained in:
ArchiDreamZ
2024-03-28 05:17:46 +08:00
committed by GitHub
parent 2655d5c2ae
commit 0c2da4fb81
@@ -93,7 +93,7 @@ public class WandHelper {
int selectedSpell = wand.stackTagCompound.getInteger(SELECTED_SPELL_KEY); int selectedSpell = wand.stackTagCompound.getInteger(SELECTED_SPELL_KEY);
if(selectedSpell < spells.length){ if(selectedSpell < spells.length && selectedSpell >= 0){
return spells[selectedSpell]; return spells[selectedSpell];
} }
} }