Skip to content

Commit

Permalink
Fix bulk cell NPE when storing items that become unregistered/removed
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Nov 27, 2023
1 parent 04c5475 commit 2884018
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static gripe._90.megacells.definition.MEGAItems.COMPRESSION_CARD;

import java.math.BigInteger;
import java.util.Objects;
import java.util.Set;

import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
Expand Down Expand Up @@ -87,11 +88,11 @@ private CompoundTag getTag() {

@Override
public CellState getStatus() {
if (unitCount.signum() == 0) {
if (unitCount.signum() < 1) {
return CellState.EMPTY;
}

if (!storedItem.equals(filterItem)) {
if (!Objects.equals(storedItem, filterItem)) {
return CellState.FULL;
}

Expand Down Expand Up @@ -160,7 +161,7 @@ public long insert(AEKey what, long amount, Actionable mode, IActionSource sourc
return 0;
}

if (filterItem == null || (storedItem != null && !filterItem.equals(storedItem))) {
if (filterItem == null || !Objects.equals(storedItem, filterItem)) {
return 0;
}

Expand Down Expand Up @@ -193,7 +194,7 @@ public long extract(AEKey what, long amount, Actionable mode, IActionSource sour
return 0;
}

if (filterItem == null || (storedItem != null && !filterItem.equals(storedItem))) {
if (filterItem == null || !Objects.equals(storedItem, filterItem)) {
return 0;
}

Expand Down

0 comments on commit 2884018

Please sign in to comment.