]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Fixed crash when attempting to access nonexistant inventory from Lua API
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 28 Nov 2020 11:08:53 +0000 (12:08 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 28 Nov 2020 11:08:53 +0000 (12:08 +0100)
src/script/lua_api/l_client.cpp

index 6c4878873325db6f933166c30fdcaa9269803b7f..5e69d55dd0371d443d633ea561be320224378997 100644 (file)
@@ -471,6 +471,8 @@ int ModApiClient::l_get_inventory(lua_State *L)
        try {
                inventory_location.deSerialize(location);
                inventory = client->getInventory(inventory_location);
+               if (! inventory)
+                       throw SerializationError(std::string("Attempt to access nonexistant inventory (") + location + ")");
                push_inventory(L, inventory);
        } catch (SerializationError &) {
                lua_pushnil(L);