From 5c5f33d124fe01b26bd97d625903c18000872adb Mon Sep 17 00:00:00 2001 From: coffee-compiler <22056268-coffee-compiler@users.noreply.gitlab.com> Date: Thu, 1 Aug 2024 01:07:32 +0000 Subject: [PATCH] Prevent empty server list entries --- voxygen/src/menu/main/mod.rs | 3 ++- voxygen/src/menu/main/ui/mod.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index f6af6126db..ec80ba0f8d 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -378,7 +378,8 @@ impl PlayState for MainMenuState { let validate_tls = net_settings.validate_tls; net_settings.username.clone_from(&username); net_settings.default_server.clone_from(&server_address); - if !net_settings.servers.contains(&server_address) { + if !server_address.is_empty() && !net_settings.servers.contains(&server_address) + { net_settings.servers.push(server_address.clone()); } global_state diff --git a/voxygen/src/menu/main/ui/mod.rs b/voxygen/src/menu/main/ui/mod.rs index dd3afa282e..41d0cedda3 100644 --- a/voxygen/src/menu/main/ui/mod.rs +++ b/voxygen/src/menu/main/ui/mod.rs @@ -534,7 +534,7 @@ impl Controls { events.push(Event::LoginAttempt { username: self.login_info.username.trim().to_string(), password: self.login_info.password.clone(), - server_address: self.login_info.server.clone(), + server_address: self.login_info.server.trim().to_string(), }); }, Message::UnlockServerField => self.server_field_locked = false,