From ae96a8d4fa9ade70672fe8d2152013c547edfb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Fri, 6 Dec 2024 22:01:31 +0100 Subject: [PATCH] Fix mainmenu crash if no servers match search fixes a regression caused by 6c324cb --- builtin/mainmenu/tab_online.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/mainmenu/tab_online.lua b/builtin/mainmenu/tab_online.lua index 6545569b2..422e9ba23 100644 --- a/builtin/mainmenu/tab_online.lua +++ b/builtin/mainmenu/tab_online.lua @@ -57,6 +57,11 @@ end -- Persists the selected server in the "address" and "remote_port" settings local function set_selected_server(server) + if server == nil then -- reset selection + core.settings:remove("address") + core.settings:remove("remote_port") + return + end local address = server.address local port = server.port gamedata.serverdescription = server.description @@ -360,6 +365,7 @@ local function main_button_handler(tabview, fields, name, tabdata) tabdata.search_for = fields.te_search search_server_list(fields.te_search:lower()) if menudata.search_result then + -- Note: This clears the selection if there are no results set_selected_server(menudata.search_result[1]) end