diff --git a/src/features/game_networking.rs b/src/features/game_networking.rs index e404af3..b19b1e1 100644 --- a/src/features/game_networking.rs +++ b/src/features/game_networking.rs @@ -138,23 +138,25 @@ impl GameNetworking { Self::is_blocked_generic(FILTER_NAME_SAVE_SERVER) } - pub fn ensure_not_both_blocked_simultaneously(&mut self, block_method: BlockMethod) { + pub fn ensure_not_both_blocked_simultaneously( + &mut self, + block_method: BlockMethod, + ) -> Result<(), Box> { match block_method { BlockMethod::EntireGame => { - if Self::is_save_server_blocked().unwrap() { - // ignoring the return because if this is an error the user can just thug it out at that point - let _ = self.unblock_save_server(); - self.blocked = Self::is_exe_blocked().unwrap(); + if Self::is_save_server_blocked()? { + self.unblock_save_server()?; + self.blocked = Self::is_exe_blocked()?; } } BlockMethod::SaveServer => { - if Self::is_exe_blocked().unwrap() { - // ignoring the return because if this is an error the user can just thug it out at that point - let _ = self.unblock_exe(); - self.blocked = Self::is_save_server_blocked().unwrap(); + if Self::is_exe_blocked()? { + self.unblock_exe()?; + self.blocked = Self::is_save_server_blocked()?; } } } + Ok(()) } } diff --git a/src/gui/app.rs b/src/gui/app.rs index 67a94fe..27e5f60 100644 --- a/src/gui/app.rs +++ b/src/gui/app.rs @@ -256,8 +256,12 @@ impl App { ui.build_menu(&mut self.settings.block_method); }); ui.label("Block method"); - self.game_networking - .ensure_not_both_blocked_simultaneously(self.settings.block_method); + if let Err(why) = self + .game_networking + .ensure_not_both_blocked_simultaneously(self.settings.block_method) + { + log::warn!("Couldn't ensure block exclusivity: {why}"); + }; }); ui.horizontal(|ui| { ui.add_enabled_ui(