summaryrefslogtreecommitdiff
path: root/luaentity.lua
diff options
context:
space:
mode:
authorPedro Gimeno <pgimeno@email.fake>2019-06-06 23:13:53 +0200
committerPedro Gimeno <pgimeno@email.fake>2019-06-06 23:13:53 +0200
commit6ad2c9f568c52297f82316d9b8528dd17962b81b (patch)
tree28309c30322354e5ac2ed2b42d1a94637d2da8e1 /luaentity.lua
parent05ca3e4f4fe6462a072334e71ce5469883d27c82 (diff)
downloadpipeworks-6ad2c9f568c52297f82316d9b8528dd17962b81b.tar
pipeworks-6ad2c9f568c52297f82316d9b8528dd17962b81b.tar.gz
pipeworks-6ad2c9f568c52297f82316d9b8528dd17962b81b.tar.bz2
pipeworks-6ad2c9f568c52297f82316d9b8528dd17962b81b.tar.xz
pipeworks-6ad2c9f568c52297f82316d9b8528dd17962b81b.zip
Prevent another crash if minetest crashes during startup
Diffstat (limited to 'luaentity.lua')
-rw-r--r--luaentity.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/luaentity.lua b/luaentity.lua
index c11c030..8385264 100644
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -46,6 +46,11 @@ local function read_entities()
end
local function write_entities()
+ if not luaentity.entities then
+ -- This can happen if crashing on startup, causing another error that
+ -- masks the original one. Return gracefully in that case instead.
+ return
+ end
for _, entity in pairs(luaentity.entities) do
setmetatable(entity, nil)
for _, attached in pairs(entity._attached_entities) do