forked from Mirrorlandia_minetest/minetest
Fix error if setting menu_last_game is not a valid game
This commit is contained in:
parent
7354d0f3d8
commit
8037eda42c
@ -33,18 +33,21 @@ local function create_world_formspec(dialogdata)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local gamepath = core.get_game(gameidx).path
|
local game_by_gameidx = core.get_game(gameidx)
|
||||||
local gameconfig = Settings(gamepath.."/game.conf")
|
if game_by_gameidx ~= nil then
|
||||||
|
local gamepath = game_by_gameidx.path
|
||||||
|
local gameconfig = Settings(gamepath.."/game.conf")
|
||||||
|
|
||||||
local disallowed_mapgens = (gameconfig:get("disallowed_mapgens") or ""):split()
|
local disallowed_mapgens = (gameconfig:get("disallowed_mapgens") or ""):split()
|
||||||
for key, value in pairs(disallowed_mapgens) do
|
for key, value in pairs(disallowed_mapgens) do
|
||||||
disallowed_mapgens[key] = value:trim()
|
disallowed_mapgens[key] = value:trim()
|
||||||
end
|
end
|
||||||
|
|
||||||
if disallowed_mapgens then
|
if disallowed_mapgens then
|
||||||
for i = #mapgens, 1, -1 do
|
for i = #mapgens, 1, -1 do
|
||||||
if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then
|
if table.indexof(disallowed_mapgens, mapgens[i]) > 0 then
|
||||||
table.remove(mapgens, i)
|
table.remove(mapgens, i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user