Skip to content

Commit

Permalink
fix: fix odd null itemstack issue in ItemStackToListCache
Browse files Browse the repository at this point in the history
An apparently "impossible" situation whch is in fact possible..?
  • Loading branch information
desht committed Aug 18, 2024
1 parent d248a5a commit 30be6a2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.util.function.Function;

/**
* An LRU cache to quickly map an itemstack (with possible NBT) to a list of something (either wrapped quest or loot
* crate "recipes"). Important for fast JEI/REI lookup.
* An LRU cache to quickly map an itemstack (with possible component data) to a list of something (either wrapped
* quest or loot crate "recipes"). Important for fast JEI/REI lookup.
*
* @param <T> type of recipe being mapped to
*/
Expand Down Expand Up @@ -44,7 +44,8 @@ public int hashCode(ItemStack object) {

@Override
public boolean equals(ItemStack o1, ItemStack o2) {
return ItemStack.isSameItemSameComponents(o1, o2);
// they _shouldn't_ ever be null, but it's apparently happened...
return o1 != null && o2 != null && ItemStack.isSameItemSameComponents(o1, o2);
}
}
}

0 comments on commit 30be6a2

Please sign in to comment.