Skip to content

Commit

Permalink
Fix core error when given an invalid potion type (CMDHELPER-3172)
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed May 31, 2018
1 parent 6cb2fb3 commit 88a131a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/com/laytonsmith/core/ObjectGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit 88a131a

Please sign in to comment.