Fix menu crash due to lack of favourites list
authorsapier <Sapier at GMX dot net>
Sun, 22 Jun 2014 12:00:57 +0000 (14:00 +0200)
committersapier <Sapier at GMX dot net>
Sun, 22 Jun 2014 12:00:57 +0000 (14:00 +0200)
builtin/mainmenu/tab_multiplayer.lua

index d2d87274e74922570b7fbc97be19cf8ec7d75486..c3a7d921e2c7ced7e4d032e77f1dbb1555df0cae 100644 (file)
@@ -138,6 +138,12 @@ local function main_button_handler(tabview, fields, name, tabdata)
                else
                        fav_idx = 1
                end
+               
+               if menudata.favorites == nil or
+                       menudata.favorites[fav_idx] == nil then
+                       tabdata.fav_selected = 0
+                       return true
+               end
        
                local address = menudata.favorites[fav_idx].address
                local port    = menudata.favorites[fav_idx].port