oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

src/window_manager: return error instead of panic in `try_reload_config` when lua_path is not found

Commit
d2f3ce90ccff47c6bc223c62873b46e6b4bf24c7
Parent
a96e35b
Author
emzywastaken <amiamemetoo@gmail.com>
Date
2025-12-15 12:24:28

Diff

diff --git a/src/window_manager.rs b/src/window_manager.rs
index cb94215..bb9e72f 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -346,11 +346,10 @@ impl WindowManager {
     }
 
     fn try_reload_config(&mut self) -> Result<(), String> {
-        let lua_path = self
-            .config
-            .path
-            .take()
-            .expect("Could not find config file. Config path should've been set while loading");
+        let lua_path =
+            self.config.path.take().ok_or(
+                "Could not find config file. Config path should've been set while loading",
+            )?;
 
         if !lua_path.exists() {
             return Err("Could not find config file, has it been moved?".to_string());