1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-10-31 15:35:02 -04:00

Fix mainmenu code downloading the public serverlist twice.

Also, fix a nil error that can happen sometimes in
menu_handle_key_up_down
This commit is contained in:
Ekdohibs 2016-04-22 14:20:16 +02:00 committed by Craig Robbins
parent 7a6502a7a5
commit 2177f3090e

View File

@ -178,7 +178,7 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
function menu_handle_key_up_down(fields, textlist, settingname) 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 or fields.key_down then
if fields.key_up and oldidx and oldidx > 1 then if fields.key_up and oldidx and oldidx > 1 then
newidx = oldidx - 1 newidx = oldidx - 1
@ -203,12 +203,20 @@ function asyncOnlineFavourites()
end end
menudata.favorites = menudata.public_known menudata.favorites = menudata.public_known
menudata.favorites_is_public = true menudata.favorites_is_public = true
if not menudata.public_downloading then
menudata.public_downloading = true
else
return
end
core.handle_async( core.handle_async(
function(param) function(param)
return core.get_favorites("online") return core.get_favorites("online")
end, end,
nil, nil,
function(result) function(result)
menudata.public_downloading = nil
local favs = order_favorite_list(result) local favs = order_favorite_list(result)
if favs[1] then if favs[1] then
menudata.public_known = favs menudata.public_known = favs