Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix attempt to start a world when no world is selected/created
  • Loading branch information
jeanpatrick.guerrero@gmail.com authored and est31 committed Jul 4, 2015
1 parent 96989e0 commit c53520a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions builtin/mainmenu/tab_singleplayer.lua
Expand Up @@ -152,12 +152,14 @@ local function main_button_handler(this, fields, name, tabdata)
world_doubleclick or
fields["key_enter"] then
local selected = core.get_textlist_index("sp_worlds")
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)

if selected ~= nil then
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
gamedata.singleplayer = true

if selected ~= nil and gamedata.selected_world ~= 0 then
gamedata.singleplayer = true
core.start()
else
gamedata.errormessage =
fgettext("No world created or selected!")
end
return true
end
Expand Down

0 comments on commit c53520a

Please sign in to comment.