From 30a63e89a73463f1080501cf69b05694f1384f92 Mon Sep 17 00:00:00 2001 From: PastaClaw Date: Sun, 22 Feb 2026 11:18:28 -0600 Subject: [PATCH 1/3] fix: replace expect() on settings save in network chooser with warnings Replace 3 panicking expect() calls on self.save() in the network chooser screen with if-let-Err + tracing::warn. A failure to persist a UI setting should not crash the application. Cherry-picked from ralph/improvements (commit 73452b6a). --- src/ui/network_chooser_screen.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/network_chooser_screen.rs b/src/ui/network_chooser_screen.rs index cb11fec43..351d3cc1a 100644 --- a/src/ui/network_chooser_screen.rs +++ b/src/ui/network_chooser_screen.rs @@ -886,7 +886,9 @@ impl NetworkChooserScreen { if is_valid { self.custom_dash_qt_path = Some(resolved_path); self.custom_dash_qt_error_message = None; - self.save().expect("Expected to save db settings"); + if let Err(e) = self.save() { + tracing::warn!("Failed to save Dash-Qt path setting: {}", e); + } } else { let required_file_name = if cfg!(target_os = "windows") { "dash-qt.exe" @@ -906,7 +908,9 @@ impl NetworkChooserScreen { if self.custom_dash_qt_path.is_some() && ui.button("Clear").clicked() { self.custom_dash_qt_path = Some(PathBuf::new()); self.custom_dash_qt_error_message = None; - self.save().expect("Expected to save db settings"); + if let Err(e) = self.save() { + tracing::warn!("Failed to save cleared Dash-Qt path setting: {}", e); + } } }); @@ -956,7 +960,9 @@ impl NetworkChooserScreen { .show(ui) .clicked() { - self.save().expect("Expected to save db settings"); + if let Err(e) = self.save() { + tracing::warn!("Failed to save overwrite_dash_conf setting: {}", e); + } } ui.label( egui::RichText::new("Auto-configure required settings") From b42c7f0a92c68541215d01f7f0073d9e690d1edc Mon Sep 17 00:00:00 2001 From: PastaClaw Date: Sun, 22 Feb 2026 11:34:51 -0600 Subject: [PATCH 2/3] fix: collapse nested if to satisfy clippy collapsible_if lint --- src/ui/network_chooser_screen.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui/network_chooser_screen.rs b/src/ui/network_chooser_screen.rs index 351d3cc1a..975ecf967 100644 --- a/src/ui/network_chooser_screen.rs +++ b/src/ui/network_chooser_screen.rs @@ -959,10 +959,9 @@ impl NetworkChooserScreen { if StyledCheckbox::new(&mut self.overwrite_dash_conf, "Overwrite dash.conf") .show(ui) .clicked() + && let Err(e) = self.save() { - if let Err(e) = self.save() { - tracing::warn!("Failed to save overwrite_dash_conf setting: {}", e); - } + tracing::warn!("Failed to save overwrite_dash_conf setting: {}", e); } ui.label( egui::RichText::new("Auto-configure required settings") From 991fd71deac1ff4c3a6ad6110704353b78eccd03 Mon Sep 17 00:00:00 2001 From: PastaClaw Date: Mon, 23 Feb 2026 07:59:16 -0600 Subject: [PATCH 3/3] fix(ui): surface network chooser save failures to users --- src/ui/network_chooser_screen.rs | 50 ++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/src/ui/network_chooser_screen.rs b/src/ui/network_chooser_screen.rs index 975ecf967..bf948ffee 100644 --- a/src/ui/network_chooser_screen.rs +++ b/src/ui/network_chooser_screen.rs @@ -858,9 +858,9 @@ impl NetworkChooserScreen { if ui.button("Select File").clicked() && let Some(path) = rfd::FileDialog::new().pick_file() { + let previous_custom_dash_qt_path = self.custom_dash_qt_path.clone(); let file_name = path.file_name().and_then(|f| f.to_str()); if let Some(file_name) = file_name { - self.custom_dash_qt_path = None; self.custom_dash_qt_error_message = None; // Handle macOS .app bundles @@ -888,6 +888,11 @@ impl NetworkChooserScreen { self.custom_dash_qt_error_message = None; if let Err(e) = self.save() { tracing::warn!("Failed to save Dash-Qt path setting: {}", e); + self.custom_dash_qt_error_message = Some( + "Failed to save Dash-Qt path setting. Please try again." + .to_string(), + ); + self.custom_dash_qt_path = previous_custom_dash_qt_path; } } else { let required_file_name = if cfg!(target_os = "windows") { @@ -906,26 +911,33 @@ impl NetworkChooserScreen { } if self.custom_dash_qt_path.is_some() && ui.button("Clear").clicked() { + let previous_custom_dash_qt_path = self.custom_dash_qt_path.clone(); self.custom_dash_qt_path = Some(PathBuf::new()); self.custom_dash_qt_error_message = None; if let Err(e) = self.save() { tracing::warn!("Failed to save cleared Dash-Qt path setting: {}", e); + self.custom_dash_qt_error_message = Some( + "Failed to clear Dash-Qt path setting. Please try again." + .to_string(), + ); + self.custom_dash_qt_path = previous_custom_dash_qt_path; } } }); - if let Some(ref file) = self.custom_dash_qt_path { - if !file.as_os_str().is_empty() { - ui.horizontal(|ui| { - ui.label("Path:"); - ui.label( - egui::RichText::new(format_path_for_display(file)) - .color(DashColors::SUCCESS) - .italics(), - ); - }); - } - } else if let Some(ref error) = self.custom_dash_qt_error_message { + if let Some(ref file) = self.custom_dash_qt_path + && !file.as_os_str().is_empty() + { + ui.horizontal(|ui| { + ui.label("Path:"); + ui.label( + egui::RichText::new(format_path_for_display(file)) + .color(DashColors::SUCCESS) + .italics(), + ); + }); + } + if let Some(ref error) = self.custom_dash_qt_error_message { let error_color = Color32::from_rgb(255, 100, 100); let error = error.clone(); Frame::new() @@ -956,12 +968,20 @@ impl NetworkChooserScreen { ui.add_space(8.0); ui.horizontal(|ui| { + let previous_overwrite_dash_conf = self.overwrite_dash_conf; if StyledCheckbox::new(&mut self.overwrite_dash_conf, "Overwrite dash.conf") .show(ui) .clicked() - && let Err(e) = self.save() { - tracing::warn!("Failed to save overwrite_dash_conf setting: {}", e); + self.custom_dash_qt_error_message = None; + if let Err(e) = self.save() { + tracing::warn!("Failed to save overwrite_dash_conf setting: {}", e); + self.custom_dash_qt_error_message = Some( + "Failed to save overwrite dash.conf setting. Please try again." + .to_string(), + ); + self.overwrite_dash_conf = previous_overwrite_dash_conf; + } } ui.label( egui::RichText::new("Auto-configure required settings")