Possible fix for #2041

This commit is contained in:
Shoghi Cervantes 2014-09-03 11:55:49 +02:00
parent 0eac084aa7
commit dea4513c34
2 changed files with 7 additions and 2 deletions

View File

@ -801,7 +801,12 @@ class Server{
* @param Player $player
*/
public function removePlayer(Player $player){
unset($this->players[$player->getAddress() . ":" . $player->getPort()]);
foreach($this->players as $identifier => $p){
if($player === $p){
unset($this->players[$identifier]);
break;
}
}
}
/**

View File

@ -119,7 +119,7 @@ class ServerScheduler{
* @param int $taskId
*/
public function cancelTask($taskId){
if(isset($this->tasks[$taskId])){
if($taskId !== null and isset($this->tasks[$taskId])){
$this->tasks[$taskId]->cancel();
unset($this->tasks[$taskId]);
}