Fixed an edge-case in AvailableCommandsPacket decoding

This commit is contained in:
Dylan K. Taylor 2019-01-07 22:23:51 +00:00
parent 4f50119b74
commit 9c16caf27b

View File

@ -144,8 +144,12 @@ class AvailableCommandsPacket extends DataPacket{
$retval->enumName = $this->getString();
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
$retval->enumValues[] = $this->enumValues[$this->getEnumValueIndex()];
$retval->enumValues[] = $this->enumValues[$index];
}
return $retval;