diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 0514c6e90..3f46d8792 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -27,6 +27,7 @@ use pocketmine\block\ItemFrame; use pocketmine\block\Sign; use pocketmine\block\utils\SignText; use pocketmine\entity\animation\ConsumingItemAnimation; +use pocketmine\entity\InvalidSkinException; use pocketmine\event\player\PlayerEditBookEvent; use pocketmine\inventory\transaction\action\InventoryAction; use pocketmine\inventory\transaction\CraftingTransaction; @@ -634,7 +635,12 @@ class InGamePacketHandler extends PacketHandler{ } public function handlePlayerSkin(PlayerSkinPacket $packet) : bool{ - return $this->player->changeSkin(SkinAdapterSingleton::get()->fromSkinData($packet->skin), $packet->newSkinName, $packet->oldSkinName); + try{ + $skin = SkinAdapterSingleton::get()->fromSkinData($packet->skin); + }catch(InvalidSkinException $e){ + throw BadPacketException::wrap($e, "Invalid skin in PlayerSkinPacket"); + } + return $this->player->changeSkin($skin, $packet->newSkinName, $packet->oldSkinName); } public function handleSubClientLogin(SubClientLoginPacket $packet) : bool{