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:
@@ -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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user