Introduce dedicated NBT data exceptions, fix up some corrupted chunk handling

This commit is contained in:
Dylan K. Taylor
2019-01-19 12:43:47 +00:00
parent c5998a92a8
commit 6b7710e62b
10 changed files with 117 additions and 49 deletions

View File

@ -31,6 +31,7 @@ use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Vector3;
use pocketmine\nbt\LittleEndianNbtSerializer;
use pocketmine\nbt\NbtDataException;
use pocketmine\network\BadPacketException;
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
use pocketmine\network\mcpe\protocol\types\EntityLink;
@ -105,7 +106,7 @@ class NetworkBinaryStream extends BinaryStream{
}
try{
$compound = self::$itemNbtSerializer->read($this->get($nbtLen));
}catch(\UnexpectedValueException $e){
}catch(NbtDataException $e){
throw new BadPacketException($e->getMessage(), 0, $e);
}
}