Add an extra sanity check to recipe index manipulation to prevent crashes (#12)

This commit is contained in:
Raven Szewczyk authored and GitHub committed 2022-06-06 17:10:11 +02:00
1 parent 8d26167423
commit 83fbd443da
3 files changed
+117 -90

No files matched your search

@@ -195,7 +195,7 @@ public class NEEContainerDrawHandler {
recipeIndex = gui.page * handler.recipiesPerPage() + i;
}
if (recipeIndex >= 0 && handler != null) {
if (recipeIndex >= 0 && handler != null && recipeIndex < handler.numRecipes()) {
IngredientTracker tracker = this.isCraftingTerm ? new IngredientTracker(gui.firstGui, handler, recipeIndex) : new IngredientTracker(gui, handler, recipeIndex);
trackerMap.put(overlayButton.id, tracker);
}