diff options
author | sapier <Sapier at GMX dot net> | 2013-07-08 21:02:42 +0200 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-07-08 19:58:03 -0400 |
commit | f419f66546b72ed265a5a4dc96569aeee8880d7a (patch) | |
tree | 9e7ec904ebb91fcee3ab27c656f9b1a7cf98dd4d /builtin | |
parent | fca4610f11748814b41b068e14a875b4cdeb6bd4 (diff) | |
download | minetest-f419f66546b72ed265a5a4dc96569aeee8880d7a.tar.gz minetest-f419f66546b72ed265a5a4dc96569aeee8880d7a.tar.bz2 minetest-f419f66546b72ed265a5a4dc96569aeee8880d7a.zip |
fix crash on play/start with empty world list
make enter button work in create world dialog
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/mainmenu.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua index 6670a5eb8..30cff823e 100644 --- a/builtin/mainmenu.lua +++ b/builtin/mainmenu.lua @@ -332,6 +332,10 @@ function menu.filtered_index_to_plain(filtered_index) local temp_idx = 0 + if menu.worldlist == nil then + return -1 + end + for i=1,#menu.worldlist,1 do if menu.worldlist[i].gameid == current_game.id then temp_idx = temp_idx +1 @@ -418,6 +422,10 @@ function menu.update_last_game(world_idx) if gamedata.selected_world <= #menu.worldlist then local world = menu.worldlist[gamedata.selected_world] + if world == nil then + return + end + for i=1,#gamemgr.games,1 do if gamemgr.games[i].id == world.gameid then menu.last_game = i @@ -574,7 +582,8 @@ end -------------------------------------------------------------------------------- function tabbuilder.handle_create_world_buttons(fields) - if fields["world_create_confirm"] then + if fields["world_create_confirm"] or + fields["key_enter"] then local worldname = fields["te_world_name"] local gameindex = engine.get_textlist_index("games") |