Maps catalog: Fix crash when index is invalid (#515)
This commit is contained in:
parent
7e73ff05eb
commit
a8aa3f98c9
1 changed files with 10 additions and 0 deletions
|
@ -7,6 +7,11 @@ local function show_catalog(name)
|
|||
local idx = indices[name]
|
||||
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]"
|
||||
|
||||
fs = fs .. "container[0,0]"
|
||||
|
@ -127,6 +132,11 @@ local function send_irc_catalog(name)
|
|||
-- Select map to be displayed
|
||||
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
|
||||
local red = string.char(3) .. "4"
|
||||
local normal = string.char(3)
|
||||
|
|
Loading…
Reference in a new issue