From: Loic Blot Date: Wed, 11 Feb 2015 10:27:52 +0000 (+0100) Subject: Don't permit to open inventory is playerCAO isn't present. This prevent to open an... X-Git-Tag: 0.4.13~632 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a9355284b5c3726de83c6dcd6136dd1ac86e02dc;p=oweals%2Fminetest.git Don't permit to open inventory is playerCAO isn't present. This prevent to open an empty inventory at player load. ok @zeno- --- diff --git a/src/game.cpp b/src/game.cpp index a1e2b807a..186e283ad 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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);