aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeanpatrick.guerrero@gmail.com <jeanpatrick.guerrero@gmail.com>2015-07-04 15:08:32 +0200
committerest31 <MTest31@outlook.com>2015-07-04 17:09:26 +0200
commitc53520aa314960855fc57bf09045c3f977557bb5 (patch)
treef44ff6714e04138b2610f388c96ca6fede065876
parent96989e0a6aa3ab069b5aeeab44a6280d6d51364a (diff)
downloadminetest-c53520aa314960855fc57bf09045c3f977557bb5.tar.gz
minetest-c53520aa314960855fc57bf09045c3f977557bb5.tar.bz2
minetest-c53520aa314960855fc57bf09045c3f977557bb5.zip
Fix attempt to start a world when no world is selected/created
-rw-r--r--builtin/mainmenu/tab_singleplayer.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/mainmenu/tab_singleplayer.lua b/builtin/mainmenu/tab_singleplayer.lua
index a7fa55666..4ae4dde35 100644
--- a/builtin/mainmenu/tab_singleplayer.lua
+++ b/builtin/mainmenu/tab_singleplayer.lua
@@ -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