mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +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];
|
$inventory = $inventories[$hash];
|
||||||
$slot = $slots[$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);
|
$sourceItem = $inventory->getItem($slot);
|
||||||
|
|
||||||
$targetItem = $this->findResultItem($sourceItem, $list);
|
$targetItem = $this->findResultItem($sourceItem, $list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user