From 0c2da4fb8102102d8b0fb4ccd6b3e92880f8432f Mon Sep 17 00:00:00 2001 From: ArchiDreamZ <89504984+ArchiDreamZ@users.noreply.github.com> Date: Thu, 28 Mar 2024 05:17:46 +0800 Subject: [PATCH] Fixed a crash when switching spells (#839) Switching spells causes ArrayIndexOutOfBoundsException: -1 when the next spell is empty.I made a simple fix --- src/main/java/electroblob/wizardry/WandHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/electroblob/wizardry/WandHelper.java b/src/main/java/electroblob/wizardry/WandHelper.java index a36202cc..4b474dc5 100644 --- a/src/main/java/electroblob/wizardry/WandHelper.java +++ b/src/main/java/electroblob/wizardry/WandHelper.java @@ -93,7 +93,7 @@ public class WandHelper { int selectedSpell = wand.stackTagCompound.getInteger(SELECTED_SPELL_KEY); - if(selectedSpell < spells.length){ + if(selectedSpell < spells.length && selectedSpell >= 0){ return spells[selectedSpell]; } }