StartGamePacket: fixed possible type violation on decoding block table

This commit is contained in:
Dylan K. Taylor 2019-12-05 11:05:34 +00:00
parent d20d9fb689
commit e3cffca34b

View File

@ -211,7 +211,11 @@ class StartGamePacket extends DataPacket{
$this->enchantmentSeed = $this->getVarInt();
$this->blockTable = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512);
$blockTable = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512);
if(!($blockTable instanceof ListTag)){
throw new \UnexpectedValueException("Wrong block table root NBT tag type");
}
$this->blockTable = $blockTable;
$this->itemTable = [];
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){