Skip to content

Commit

Permalink
InventoryTransaction: Avoid crashing when trying to compact slot chan…
Browse files Browse the repository at this point in the history
…ges with invalid slot numbers

fixes #2250
  • Loading branch information
dktapps committed Jun 19, 2018
1 parent 0351033 commit d2a037d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pocketmine/inventory/transaction/InventoryTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ protected function squashDuplicateSlotChanges() : void{

$inventory = $inventories[$hash];
$slot = $slots[$hash];
if(!$inventory->slotExists($slot)){ //this can get hit for crafting tables because the validation happens after this compaction
throw new TransactionValidationException("Slot $slot does not exist in inventory " . get_class($inventory));
}
$sourceItem = $inventory->getItem($slot);

$targetItem = $this->findResultItem($sourceItem, $list);
Expand Down

0 comments on commit d2a037d

Please sign in to comment.