Skip to content

Commit

Permalink
Protect against more ItemStack crashes (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Oct 5, 2016
1 parent 27468ce commit f14302d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/main/java/mezz/jei/IngredientRegistry.java
Expand Up @@ -41,12 +41,28 @@ public IngredientRegistry(
String modId = itemStackHelper.getModId(itemStack).toLowerCase(Locale.ENGLISH);
itemsByModIdBuilder.put(modId, itemStack);

if (TileEntityFurnace.isItemFuel(itemStack)) {
fuelsBuilder.add(itemStack);
try {
if (TileEntityFurnace.isItemFuel(itemStack)) {
fuelsBuilder.add(itemStack);
}
} catch (RuntimeException e) {
String itemStackInfo = itemStackHelper.getErrorInfo(itemStack);
Log.error("Failed to check if item is fuel {}.", itemStackInfo, e);
} catch (LinkageError e) {
String itemStackInfo = itemStackHelper.getErrorInfo(itemStack);
Log.error("Failed to check if item is fuel {}.", itemStackInfo, e);
}

if (PotionHelper.isReagent(itemStack)) {
potionIngredientsBuilder.add(itemStack);
try {
if (PotionHelper.isReagent(itemStack)) {
potionIngredientsBuilder.add(itemStack);
}
} catch (RuntimeException e) {
String itemStackInfo = itemStackHelper.getErrorInfo(itemStack);
Log.error("Failed to check if item is a potion ingredient {}.", itemStackInfo, e);
} catch (LinkageError e) {
String itemStackInfo = itemStackHelper.getErrorInfo(itemStack);
Log.error("Failed to check if item is a potion ingredient {}.", itemStackInfo, e);
}
}

Expand Down

0 comments on commit f14302d

Please sign in to comment.