mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
InventoryTransaction: Avoid crashing when trying to compact slot changes with invalid slot numbers
fixes #2250
This commit is contained in:
parent
03510333dc
commit
d2a037de71
@ -173,6 +173,9 @@ class InventoryTransaction{
|
||||
|
||||
$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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user