Skip to content

Commit e1bd237

Browse files
fix: network UI crashes. (#770)
Address a couple network crashes around UI functionality
1 parent 8324419 commit e1bd237

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ book/dist
88
.vscode
99
trace-*.json
1010
perf.data*
11-
callgrind.out*
11+
callgrind.out*
12+
.cargo

src/ui/main_menu/network_game.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ impl<'w, 's> WidgetSystem for MatchmakingMenu<'w, 's> {
609609
*matchmaking_server = params
610610
.storage
611611
.get::<Settings>(Settings::STORAGE_KEY)
612-
.unwrap()
612+
.unwrap_or_else(|| params.game.default_settings.clone())
613613
.matchmaking_server;
614614
}
615615

@@ -734,9 +734,10 @@ impl<'w, 's> WidgetSystem for MatchmakingMenu<'w, 's> {
734734
match status {
735735
Status::Idle => (),
736736
Status::Searching => {
737-
ONLINE_MATCHMAKER
738-
.try_send(networking::OnlineMatchmakerRequest::StopSearch)
739-
.unwrap();
737+
if let Err(err) = ONLINE_MATCHMAKER.try_send(networking::OnlineMatchmakerRequest::StopSearch){
738+
error!("Error stopping search: {:?}", err);
739+
}
740+
740741
*status = Status::Idle;
741742
}
742743
Status::Joining => {

0 commit comments

Comments
 (0)