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, rot_imgs,
username: networking.username.clone(), username: networking.username.clone(),
password: "".to_owned(), 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, popup: None,
connecting: None, connecting: None,
show_servers: false, show_servers: false,