mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Get rid of some network-layer asserts
NEVER assert on user data. 🤦
This commit is contained in:
parent
3f5e83a322
commit
daf56e990b
@ -114,7 +114,9 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
|||||||
$this->yOffset = $this->getVarInt();
|
$this->yOffset = $this->getVarInt();
|
||||||
|
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
assert($count === $this->width * $this->height);
|
if($count !== $this->width * $this->height){
|
||||||
|
throw new \UnexpectedValueException("Expected colour count of " . ($this->height * $this->width) . " (height $this->height * width $this->width), got $count");
|
||||||
|
}
|
||||||
|
|
||||||
for($y = 0; $y < $this->height; ++$y){
|
for($y = 0; $y < $this->height; ++$y){
|
||||||
for($x = 0; $x < $this->width; ++$x){
|
for($x = 0; $x < $this->width; ++$x){
|
||||||
|
@ -76,7 +76,9 @@ abstract class DataPacket extends NetworkBinaryStream{
|
|||||||
|
|
||||||
protected function decodeHeader(){
|
protected function decodeHeader(){
|
||||||
$pid = $this->getUnsignedVarInt();
|
$pid = $this->getUnsignedVarInt();
|
||||||
assert($pid === static::NETWORK_ID);
|
if($pid !== static::NETWORK_ID){
|
||||||
|
throw new \UnexpectedValueException("Expected " . static::NETWORK_ID . " for packet ID, got $pid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user