Skip to content

Commit 88a131a

Browse files
committed
Fix core error when given an invalid potion type (CMDHELPER-3172)
1 parent 6cb2fb3 commit 88a131a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/com/laytonsmith/core/ObjectGenerator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,12 @@ public CArray potionData(MCPotionData mcpd, Target t) {
11681168
}
11691169

11701170
public MCPotionData potionData(CArray pd, Target t) {
1171-
MCPotionType type = MCPotionType.valueOf(pd.get("type", t).val().toUpperCase());
1171+
MCPotionType type;
1172+
try {
1173+
type = MCPotionType.valueOf(pd.get("type", t).val().toUpperCase());
1174+
} catch(IllegalArgumentException ex) {
1175+
throw new CREFormatException("Invalid potion type: " + pd.get("type", t).val(), t);
1176+
}
11721177
boolean extended = false;
11731178
boolean upgraded = false;
11741179
if(pd.containsKey("extended")) {

0 commit comments

Comments
 (0)