LoginPacket: protocol cannot be NULL

This commit is contained in:
Dylan K. Taylor 2020-08-04 16:55:47 +01:00
parent 0766952f39
commit 8da7e789fd
2 changed files with 3 additions and 3 deletions

View File

@ -1898,7 +1898,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
//This pocketmine disconnect message will only be seen by the console (PlayStatusPacket causes the messages to be shown for the client)
$this->close("", $this->server->getLanguage()->translateString("pocketmine.disconnect.incompatibleProtocol", [$packet->protocol ?? "unknown"]), false);
$this->close("", $this->server->getLanguage()->translateString("pocketmine.disconnect.incompatibleProtocol", [$packet->protocol]), false);
return true;
}

View File

@ -78,7 +78,7 @@ class LoginPacket extends DataPacket{
}
public function mayHaveUnreadBytes() : bool{
return $this->protocol !== null and $this->protocol !== ProtocolInfo::CURRENT_PROTOCOL;
return $this->protocol !== ProtocolInfo::CURRENT_PROTOCOL;
}
protected function decodePayload(){
@ -92,7 +92,7 @@ class LoginPacket extends DataPacket{
}
$logger = MainLogger::getLogger();
$logger->debug(get_class($e) . " was thrown while decoding connection request in login (protocol version " . ($this->protocol ?? "unknown") . "): " . $e->getMessage());
$logger->debug(get_class($e) . " was thrown while decoding connection request in login (protocol version $this->protocol): " . $e->getMessage());
foreach(Utils::printableTrace($e->getTrace()) as $line){
$logger->debug($line);
}