Prevent empty server list entries

This commit is contained in:
coffee-compiler 2024-08-01 01:07:32 +00:00 committed by Marcel
parent 409852591f
commit 5c5f33d124
2 changed files with 3 additions and 2 deletions

View File

@ -378,7 +378,8 @@ impl PlayState for MainMenuState {
let validate_tls = net_settings.validate_tls; let validate_tls = net_settings.validate_tls;
net_settings.username.clone_from(&username); net_settings.username.clone_from(&username);
net_settings.default_server.clone_from(&server_address); 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()); net_settings.servers.push(server_address.clone());
} }
global_state global_state

View File

@ -534,7 +534,7 @@ impl Controls {
events.push(Event::LoginAttempt { events.push(Event::LoginAttempt {
username: self.login_info.username.trim().to_string(), username: self.login_info.username.trim().to_string(),
password: self.login_info.password.clone(), 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, Message::UnlockServerField => self.server_field_locked = false,