Fix attempt to start a world when no world is selected/created

This commit is contained in:
jeanpatrick.guerrero@gmail.com 2015-07-04 15:08:32 +02:00 committed by est31
parent 96989e0a6a
commit c53520aa31

@ -152,12 +152,14 @@ local function main_button_handler(this, fields, name, tabdata)
world_doubleclick or world_doubleclick or
fields["key_enter"] then fields["key_enter"] then
local selected = core.get_textlist_index("sp_worlds") local selected = core.get_textlist_index("sp_worlds")
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
if selected ~= nil then if selected ~= nil and gamedata.selected_world ~= 0 then
gamedata.selected_world = menudata.worldlist:get_raw_index(selected) gamedata.singleplayer = true
gamedata.singleplayer = true
core.start() core.start()
else
gamedata.errormessage =
fgettext("No world created or selected!")
end end
return true return true
end end