Skip to content

Commit

Permalink
Fix #454 Crash when viewing all recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Sep 26, 2016
1 parent 3fe305f commit c1d0e54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/mezz/jei/gui/ingredients/GuiIngredient.java
Expand Up @@ -107,7 +107,7 @@ public void set(T ingredient, IFocus<T> focus) {
public void set(List<T> ingredients, IFocus<T> focus) {
this.displayIngredients.clear();
this.allIngredients.clear();
ingredientHelper.expandSubtypes(ingredients);
ingredients = this.ingredientHelper.expandSubtypes(ingredients);

T match = getMatch(ingredients, focus);
if (match != null) {
Expand Down
Expand Up @@ -19,6 +19,7 @@
import mezz.jei.api.recipe.IFocus;
import mezz.jei.input.ClickedIngredient;
import mezz.jei.input.IClickedIngredient;
import mezz.jei.util.Log;
import net.minecraft.client.Minecraft;

public class GuiIngredientGroup<T> implements IGuiIngredientGroup<T> {
Expand Down Expand Up @@ -84,6 +85,13 @@ public void set(int slotIndex, Collection<T> values) {

@Override
public void set(int slotIndex, List<T> ingredients) {
// Sanitize API input
for (T ingredient : ingredients) {
if (!ingredientClass.isInstance(ingredient)) {
Log.error("Received wrong type of ingredient. Expected {}, got {}", ingredientClass, ingredient.getClass(), new IllegalArgumentException());
return;
}
}
guiIngredients.get(slotIndex).set(ingredients, focus);
}

Expand Down

0 comments on commit c1d0e54

Please sign in to comment.