Skip to content

Commit

Permalink
InGamePacketHandler: fixed crash when attempting to drop more of an i…
Browse files Browse the repository at this point in the history
…tem than is available
  • Loading branch information
dktapps committed Mar 27, 2023
1 parent eca9fe5 commit 5897476
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/network/mcpe/handler/InGamePacketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 :(
Expand Down

0 comments on commit 5897476

Please # to comment.