Skip to content

Commit

Permalink
Fix NPE in InventoryTransactionHandler_v390ee_to_v408be
Browse files Browse the repository at this point in the history
  • Loading branch information
bundabrg committed Feb 17, 2021
1 parent 6d557c6 commit cad5452
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public boolean fromUpstream(InventoryTransactionPacket packet) {

// If using an Item with action on a block we will wait up to 5ms to see if we also have an action on the air
// If so, we will send both packets upstream. If not, we send this packet + a block_interact upstream
if (packet.getTransactionType() == TransactionType.ITEM_USE) {
if (packet.getTransactionType() == TransactionType.ITEM_USE && packet.getBlockPosition() != null) {
// Action on the block
if (packet.getActionType() == 0) {
PendingUseItem pending = new PendingUseItem();
Expand Down Expand Up @@ -105,7 +105,7 @@ public boolean fromUpstream(InventoryTransactionPacket packet) {
// Action on the air
if (packet.getActionType() == 1) {
PendingUseItem pending = getPendingUseItems().stream()
.filter(i -> i.getFirstPacket().getPlayerPosition().equals(packet.getPlayerPosition()))
.filter(i -> i.getFirstPacket().getBlockPosition().equals(packet.getBlockPosition()))
.findFirst()
.orElse(null);

Expand Down

0 comments on commit cad5452

Please sign in to comment.