From 3c9055c7237ca62962c3ec20a44e40d70a09bc44 Mon Sep 17 00:00:00 2001 From: Niklp Date: Thu, 17 Oct 2024 11:14:04 +0200 Subject: [PATCH] Fix crash when `doors.registered_doors` isn't available --- mesecons_doors/init.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mesecons_doors/init.lua b/mesecons_doors/init.lua index 8b6b33c..1f27328 100644 --- a/mesecons_doors/init.lua +++ b/mesecons_doors/init.lua @@ -132,14 +132,16 @@ local function meseconify_trapdoor(name) end minetest.register_on_mods_loaded(function() - for k,_ in pairs(doors.registered_doors) do - if k:find("_a$") then - meseconify_door(k:sub(1,-3)) + if doors.registered_doors ~= nil then -- registered_doors is not always available + for k,_ in pairs(doors.registered_doors) do + if k:find("_a$") then + meseconify_door(k:sub(1,-3)) + end end - end - for k,_ in pairs(doors.registered_trapdoors) do - if not k:find("_open$") then - meseconify_trapdoor(k) + for k,_ in pairs(doors.registered_trapdoors) do + if not k:find("_open$") then + meseconify_trapdoor(k) + end end end end)