diff --git a/dat/themerms.lua b/dat/themerms.lua index b7e0f1f0a..64c1b316e 100644 --- a/dat/themerms.lua +++ b/dat/themerms.lua @@ -936,7 +936,7 @@ function themerooms_generate() themerooms[actualrm].contents(); return end - local pick = 1; + local pick = nil; local total_frequency = 0; for i = 1, #themerooms do if (type(themerooms[i]) ~= "table") then @@ -957,6 +957,10 @@ function themerooms_generate() end end end + if pick == nil then + nh.impossible('no eligible themed rooms?') + return + end themerooms[pick].contents(); end @@ -995,7 +999,7 @@ function themeroom_fill(rm) end return end - local pick = 1; + local pick = nil; local total_frequency = 0; for i = 1, #themeroom_fills do if (type(themeroom_fills[i]) ~= "table") then @@ -1016,6 +1020,10 @@ function themeroom_fill(rm) end end end + if pick == nil then + nh.impossible('no eligible themed room fills?') + return + end themeroom_fills[pick].contents(rm); end