Skip to content

Commit 8638540

Browse files
committed
Fix hash strategy for fluid stacks as apparently it is also used for comparing against the null case of not being present
1 parent 736ca68 commit 8638540

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/mekanism/common/lib/collection/FluidHashStrategy.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ private FluidHashStrategy() {
1212

1313
@Override
1414
public int hashCode(FluidStack stack) {
15-
return FluidStack.hashFluidAndComponents(stack);
15+
return stack == null ? 0 : FluidStack.hashFluidAndComponents(stack);
1616
}
1717

1818
@Override
1919
public boolean equals(FluidStack a, FluidStack b) {
20+
if (a == b) {
21+
return true;
22+
} else if (a == null || b == null) {
23+
return false;
24+
}
2025
return FluidStack.isSameFluidSameComponents(a, b);
2126
}
2227
}

0 commit comments

Comments
 (0)