InGamePacketHandler: fixed crash when attempting to drop more of an item than is available

This commit is contained in:
Dylan K. Taylor 2023-03-27 13:03:01 +01:00
parent eca9fe50b6
commit 58974765a6
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -415,6 +415,9 @@ class InGamePacketHandler extends PacketHandler{
}
$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 :(