diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-28 12:08:53 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-28 12:08:53 +0100 |
commit | 8de51dae97aa2fe6ea02e4cf437bfe2b2a38eb06 (patch) | |
tree | 6c9252e08b14ed29dba51cd084101d35d559525b /src/script/lua_api | |
parent | a65251a7a88e51f2d0039d0a4c032f9090a13025 (diff) | |
download | dragonfireclient-8de51dae97aa2fe6ea02e4cf437bfe2b2a38eb06.tar.xz |
Fixed crash when attempting to access nonexistant inventory from Lua API
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_client.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 6c4878873..5e69d55dd 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -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); |