Don't permit to open inventory is playerCAO isn't present. This prevent to open an... 2183/head
authorLoic Blot <loic.blot@unix-experience.fr>
Wed, 11 Feb 2015 10:27:52 +0000 (11:27 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Wed, 11 Feb 2015 11:23:14 +0000 (12:23 +0100)
src/game.cpp

index a1e2b807a28ce86aecfa1956d0f727491f7864ee..186e283adb1478dfabbc0ac46f4a8342054cbaed 100644 (file)
@@ -2669,6 +2669,15 @@ void Game::dropSelectedItem()
 
 void Game::openInventory()
 {
+       /*
+        * Don't permit to open inventory is CAO or player doesn't exists.
+        * This prevent showing an empty inventory at player load
+        */
+
+       LocalPlayer *player = client->getEnv().getLocalPlayer();
+       if (player == NULL || player->getCAO() == NULL)
+               return;
+
        infostream << "the_game: " << "Launching inventory" << std::endl;
 
        PlayerInventoryFormSource *fs_src = new PlayerInventoryFormSource(client);