From 58974765a68f63a9968a7ff3a06f584ff2ee08d2 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 27 Mar 2023 13:03:01 +0100 Subject: [PATCH] InGamePacketHandler: fixed crash when attempting to drop more of an item than is available --- src/network/mcpe/handler/InGamePacketHandler.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 213ce2b8c5a..3e082591584 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -415,6 +415,9 @@ private function handleNormalTransaction(NormalTransactionData $data, int $itemS } $sourceSlotItem = $inventory->getItem($sourceSlot); + if($sourceSlotItem->getCount() < $droppedCount){ + return false; + } $serverItemStack = TypeConverter::getInstance()->coreItemStackToNet($sourceSlotItem); //because the client doesn't tell us the expected itemstack ID, we have to deep-compare our known //itemstack info with the one the client sent. This is costly, but we don't have any other option :(