Skip to content

Commit

Permalink
Fix mainmenu code downloading the public serverlist twice.
Browse files Browse the repository at this point in the history
Also, fix a nil error that can happen sometimes in
menu_handle_key_up_down
  • Loading branch information
Ekdohibs authored and Zeno- committed Apr 22, 2016
1 parent 7a6502a commit 2177f30
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion builtin/mainmenu/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2177f30

Please sign in to comment.