From 6fb8e754d6756a8de87946a073c6d9325e95c3b0 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Mon, 18 Mar 2013 15:06:39 +0100 Subject: [PATCH] Fixed #142 Server crash while using whitelist --- src/API/PlayerAPI.php | 2 +- src/Player.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index 74055df1..913613a4 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -258,7 +258,7 @@ class PlayerAPI{ $this->server->clients[$CID] = null; unset($this->server->clients[$CID]); $player->close(); - if($player->username != ""){ + if($player->username != "" and ($player->data instanceof Config)){ $this->saveOffline($player->data); } $this->server->query("DELETE FROM players WHERE name = '".$player->username."';"); diff --git a/src/Player.php b/src/Player.php index 92c09a28..b8d79db3 100644 --- a/src/Player.php +++ b/src/Player.php @@ -635,7 +635,9 @@ class Player{ $this->data->set("lastIP", $this->ip); $this->data->set("lastID", $this->clientID); - $this->server->api->player->saveOffline($this->data); + if($this->data instanceof Config){ + $this->server->api->player->saveOffline($this->data); + } $this->dataPacket(MC_LOGIN_STATUS, array( "status" => 0, ));