mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 10:31:51 +00:00
ItemStackRequestExecutor: fixed another possible crash condition
This commit is contained in:
parent
ccd288d7fa
commit
955f7944bb
@ -141,6 +141,9 @@ final class ItemStackRequestExecutor{
|
|||||||
private function removeItemFromSlot(ItemStackRequestSlotInfo $slotInfo, int $count) : Item{
|
private function removeItemFromSlot(ItemStackRequestSlotInfo $slotInfo, int $count) : Item{
|
||||||
$this->requestSlotInfos[] = $slotInfo;
|
$this->requestSlotInfos[] = $slotInfo;
|
||||||
[$inventory, $slot] = $this->getBuilderInventoryAndSlot($slotInfo);
|
[$inventory, $slot] = $this->getBuilderInventoryAndSlot($slotInfo);
|
||||||
|
if($count === 0){
|
||||||
|
throw new ItemStackRequestProcessException($this->prettyInventoryAndSlot($inventory, $slot) . ": Cannot take 0 items from a stack");
|
||||||
|
}
|
||||||
|
|
||||||
$existingItem = $inventory->getItem($slot);
|
$existingItem = $inventory->getItem($slot);
|
||||||
if($existingItem->getCount() < $count){
|
if($existingItem->getCount() < $count){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user