Fix panic if default server index is out of bounds

This commit is contained in:
Olexorus 2020-04-13 19:28:13 +02:00
parent 198b8a4994
commit 027d0f11da

View File

@ -205,7 +205,10 @@ impl MainMenuUi {
rot_imgs,
username: networking.username.clone(),
password: "".to_owned(),
server_address: networking.servers[networking.default_server].clone(),
server_address: networking
.servers
.get(networking.default_server)
.map_or_else(|| String::new(), |address| address.clone()),
popup: None,
connecting: None,
show_servers: false,