Fix NPE in WandHelper#getCurrentCooldown

This commit is contained in:
Electroblob77
2019-09-05 00:47:50 +01:00
parent 9924e10f13
commit 4cde8c60bc
@@ -50,7 +50,7 @@ public final class WandHelper {
public static final String UPGRADES_KEY = "upgrades";
public static final String PROGRESSION_KEY = "progression";
private static final HashMap<Item, String> upgradeMap = new HashMap<Item, String>();
private static final HashMap<Item, String> upgradeMap = new HashMap<>();
static {
upgradeMap.put(WizardryItems.condenser_upgrade, "condenser");
@@ -251,6 +251,8 @@ public final class WandHelper {
/** Returns the given wand's cooldown for the currently selected spell, or 0 if the wand has no cooldown data. */
public static int getCurrentCooldown(ItemStack wand){
if(wand.getTagCompound() == null) wand.setTagCompound(new NBTTagCompound());
int[] cooldowns = getCooldowns(wand);
int selectedSpell = wand.getTagCompound().getInteger(SELECTED_SPELL_KEY);