From 99566068991c1c114dfa94a16ba615182fc149c3 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Sun, 12 May 2019 19:19:14 +0200 Subject: [PATCH] Maps catalog: Abort if no maps are available (#412) --- mods/ctf/ctf_map/maps_catalog.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ctf/ctf_map/maps_catalog.lua b/mods/ctf/ctf_map/maps_catalog.lua index 1c5d55c..1004eb7 100644 --- a/mods/ctf/ctf_map/maps_catalog.lua +++ b/mods/ctf/ctf_map/maps_catalog.lua @@ -83,6 +83,9 @@ end) minetest.register_chatcommand("maps", { privs = {interact = true}, func = function(name, param) + if #ctf_map.available_maps == 0 then + return false, "No maps are available!" + end if not minetest.get_player_by_name(name) then return false, "You must be online to view the maps catalog!" end @@ -104,7 +107,7 @@ minetest.register_chatcommand("maps", { end end else - idx = indices[name] or ctf_map.map.idx + idx = indices[name] or ctf_map.map and ctf_map.map.idx or 1 end show_catalog(name, idx or 1)