mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Fixed an edge-case in AvailableCommandsPacket decoding
This commit is contained in:
parent
c2c210e25a
commit
00644dd529
@ -147,8 +147,12 @@ class AvailableCommandsPacket extends DataPacket{
|
|||||||
$retval->enumName = $this->getString();
|
$retval->enumName = $this->getString();
|
||||||
|
|
||||||
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
|
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
|
||||||
|
$index = $this->getEnumValueIndex();
|
||||||
|
if(!isset($this->enumValues[$index])){
|
||||||
|
throw new \UnexpectedValueException("Invalid enum value index $index");
|
||||||
|
}
|
||||||
//Get the enum value from the initial pile of mess
|
//Get the enum value from the initial pile of mess
|
||||||
$retval->enumValues[] = $this->enumValues[$this->getEnumValueIndex()];
|
$retval->enumValues[] = $this->enumValues[$index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user