Permalink
Browse files

Fix core error when given an invalid potion type (CMDHELPER-3172)

  • Loading branch information...
PseudoKnight committed May 31, 2018
1 parent 6cb2fb3 commit 88a131aa912c66fab82b1064c9b345f221dc21a8
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/com/laytonsmith/core/ObjectGenerator.java
@@ -1168,7 +1168,12 @@ public CArray potionData(MCPotionData mcpd, Target t) {
}
public MCPotionData potionData(CArray pd, Target t) {
MCPotionType type = MCPotionType.valueOf(pd.get("type", t).val().toUpperCase());
MCPotionType type;
try {
type = MCPotionType.valueOf(pd.get("type", t).val().toUpperCase());
} catch(IllegalArgumentException ex) {
throw new CREFormatException("Invalid potion type: " + pd.get("type", t).val(), t);
}
boolean extended = false;
boolean upgraded = false;
if(pd.containsKey("extended")) {

0 comments on commit 88a131a

Please sign in to comment.