mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix mainmenu crash if no servers match search
fixes a regression caused by 6c324cb
This commit is contained in:
parent
b857798848
commit
ae96a8d4fa
1 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,11 @@ end
|
||||||
|
|
||||||
-- Persists the selected server in the "address" and "remote_port" settings
|
-- Persists the selected server in the "address" and "remote_port" settings
|
||||||
local function set_selected_server(server)
|
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 address = server.address
|
||||||
local port = server.port
|
local port = server.port
|
||||||
gamedata.serverdescription = server.description
|
gamedata.serverdescription = server.description
|
||||||
|
@ -360,6 +365,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||||
tabdata.search_for = fields.te_search
|
tabdata.search_for = fields.te_search
|
||||||
search_server_list(fields.te_search:lower())
|
search_server_list(fields.te_search:lower())
|
||||||
if menudata.search_result then
|
if menudata.search_result then
|
||||||
|
-- Note: This clears the selection if there are no results
|
||||||
set_selected_server(menudata.search_result[1])
|
set_selected_server(menudata.search_result[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue