Skip to content

Commit

Permalink
Recipe remove NPE (#775)
Browse files Browse the repository at this point in the history
* Fix occasional NPE

* Remove null items

* Use log instead of stdout

Co-authored-by: Raven Szewczyk <[email protected]>

* log StackTrace in warn

---------

Co-authored-by: Raven Szewczyk <[email protected]>
  • Loading branch information
ghostflyby and eigenraven authored Dec 10, 2023
1 parent 6fe4a80 commit 927466d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/com/dreammaster/recipes/RecipeRemover.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ private static void stopBuffering() {
int i = tList.size();
tList.removeIf(r -> {
ItemStack rCopy = r.getRecipeOutput();
if (rCopy == null) return false; // ????????????????????
if (rCopy == null) {
return false;
}
if (rCopy.getItem() == null) {
MainRegistry.Logger.warn("Someone is adding recipes with null items!");
for (StackTraceElement element : Thread.currentThread().getStackTrace()) {
MainRegistry.Logger.warn(element.toString());
}
return true;
}
if (rCopy.stackTagCompound != null) {
rCopy = rCopy.copy();
rCopy.stackTagCompound = null;
Expand Down

0 comments on commit 927466d

Please sign in to comment.