Merge branch 'coffee-compiler/prevent_empty_server_list_entries' into 'master'

Prevent empty server list entries

See merge request veloren/veloren!4544
This commit is contained in:
Marcel 2024-08-01 01:07:33 +00:00
commit b78749e01b
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,