aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorEkdohibs <nathanael.courant@laposte.net>2016-04-22 14:20:16 +0200
committerCraig Robbins <kde.psych@gmail.com>2016-04-22 23:39:54 +1000
commit2177f3090e6bb8037779a5b518f193a03094797f (patch)
tree43b85185aade03024b893aba8487e883cd9bfbc6 /builtin
parent7a6502a7a5007e4bed8c1dd10af39d4fa2b296a4 (diff)
downloadminetest-2177f3090e6bb8037779a5b518f193a03094797f.tar.gz
minetest-2177f3090e6bb8037779a5b518f193a03094797f.tar.bz2
minetest-2177f3090e6bb8037779a5b518f193a03094797f.zip
Fix mainmenu code downloading the public serverlist twice.
Also, fix a nil error that can happen sometimes in menu_handle_key_up_down
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mainmenu/common.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua
index 5bf39abd7..1fd89ff77 100644
--- a/builtin/mainmenu/common.lua
+++ b/builtin/mainmenu/common.lua
@@ -178,7 +178,7 @@ end
--------------------------------------------------------------------------------
function menu_handle_key_up_down(fields, textlist, settingname)
- local oldidx, newidx = core.get_textlist_index(textlist)
+ local oldidx, newidx = core.get_textlist_index(textlist), 1
if fields.key_up or fields.key_down then
if fields.key_up and oldidx and oldidx > 1 then
newidx = oldidx - 1
@@ -203,12 +203,20 @@ function asyncOnlineFavourites()
end
menudata.favorites = menudata.public_known
menudata.favorites_is_public = true
+
+ if not menudata.public_downloading then
+ menudata.public_downloading = true
+ else
+ return
+ end
+
core.handle_async(
function(param)
return core.get_favorites("online")
end,
nil,
function(result)
+ menudata.public_downloading = nil
local favs = order_favorite_list(result)
if favs[1] then
menudata.public_known = favs