Maps catalog: Fix crash when index is invalid (#515)

This commit is contained in:
Thomas--S 2019-11-25 07:17:23 +01:00 committed by ANAND
parent 7e73ff05eb
commit a8aa3f98c9

View file

@ -7,6 +7,11 @@ local function show_catalog(name)
local idx = indices[name] local idx = indices[name]
local map = ctf_map.available_maps[idx] local map = ctf_map.available_maps[idx]
if not map then
minetest.chat_send_player(name, "No such map found.")
return
end
local fs = "size[10,9]" local fs = "size[10,9]"
fs = fs .. "container[0,0]" fs = fs .. "container[0,0]"
@ -127,6 +132,11 @@ local function send_irc_catalog(name)
-- Select map to be displayed -- Select map to be displayed
local map = ctf_map.available_maps[indices[name]] local map = ctf_map.available_maps[indices[name]]
if not map then
minetest.chat_send_player(name, "No such map found.")
return
end
-- IRC color codes -- IRC color codes
local red = string.char(3) .. "4" local red = string.char(3) .. "4"
local normal = string.char(3) local normal = string.char(3)