tony / oxwm

Fixed panic caused by double .unwrap() in the event that no windows are opened, but fullscreen is sent. Browse files
tonybanters committed 2025-12-12 parent 86b598f commit 93ceb27284508adb70b94393786de8612535f01d
Showing 1 changed file with 10 additions and 4 deletions. UnifiedSplit
+10 −4 src/window_manager.rs
@@ -1420,11 +1420,14 @@ impl WindowManager {
1420 1420 .copied()
1421 1421 .collect();
1422 1422
1423 - let focused = self
1423 + let focused = match self
1424 1424 .monitors
1425 1425 .get(self.selected_monitor)
1426 1426 .and_then(|m| m.selected_client)
1427 - .unwrap();
1427 + {
1428 + Some(window) => window,
1429 + None => return Ok(()),
1430 + };
1428 1431
1429 1432 self.fullscreen_windows.insert(focused);
1430 1433
@@ -1496,11 +1499,14 @@ impl WindowManager {
1496 1499 }
1497 1500 self.connection.flush()?;
1498 1501 } else {
1499 - let focused = self
1502 + let focused = match self
1500 1503 .monitors
1501 1504 .get(self.selected_monitor)
1502 1505 .and_then(|m| m.selected_client)
1503 - .unwrap();
1506 + {
1507 + Some(window) => window,
1508 + None => return Ok(()),
1509 + };
1504 1510
1505 1511 self.fullscreen_windows.remove(&focused);
1506 1512