diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index e9090e733..f3896a28b 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1313,6 +1313,8 @@ void push_tool_capabilities(lua_State *L, /******************************************************************************/ void push_inventory(lua_State *L, Inventory *inventory) { + if (! inventory) + throw SerializationError("Attempt to push nonexistant inventory"); std::vector lists = inventory->getLists(); std::vector::iterator iter = lists.begin(); lua_createtable(L, 0, lists.size()); @@ -1869,7 +1871,7 @@ void push_pointed_thing(lua_State *L, const PointedThing &pointed, bool csm, } else { push_objectRef(L, pointed.object_id); } - + lua_setfield(L, -2, "ref"); } else { lua_pushstring(L, "nothing"); @@ -2129,7 +2131,7 @@ void push_collision_move_result(lua_State *L, const collisionMoveResult &res) void push_physics_override(lua_State *L, float speed, float jump, float gravity, bool sneak, bool sneak_glitch, bool new_move) { lua_createtable(L, 0, 6); - + lua_pushnumber(L, speed); lua_setfield(L, -2, "speed");