Fixed Query-related crash

This commit is contained in:
Shoghi Cervantes 2014-11-01 16:20:40 +01:00
parent 90777014b6
commit bf596ebf05

View File

@ -631,9 +631,16 @@ class Server{
* @param string $payload * @param string $payload
*/ */
public function handlePacket($address, $port, $payload){ public function handlePacket($address, $port, $payload){
if(strlen($payload) > 2 and substr($payload, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler){ try{
$this->queryHandler->handle($address, $port, $payload); if(strlen($payload) > 2 and substr($payload, 0, 2) === "\xfe\xfd" and $this->queryHandler instanceof QueryHandler){
} //TODO: add raw packet events $this->queryHandler->handle($address, $port, $payload);
}
}catch(\Exception $e){
if($this->logger instanceof MainLogger){
$this->logger->logException($e);
}
}
//TODO: add raw packet events
} }
/** /**
@ -2171,7 +2178,13 @@ class Server{
if(($this->tickCounter & 0b1111) === 0){ if(($this->tickCounter & 0b1111) === 0){
$this->titleTick(); $this->titleTick();
if(isset($this->queryHandler) and ($this->tickCounter & 0b111111111) === 0){ if(isset($this->queryHandler) and ($this->tickCounter & 0b111111111) === 0){
$this->queryHandler->regenerateInfo(); try{
$this->queryHandler->regenerateInfo();
}catch(\Exception $e){
if($this->logger instanceof MainLogger){
$this->logger->logException($e);
}
}
} }
} }