diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-10 20:09:28 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-10 20:09:28 +0400 |
| commit | 00806d1f082d19728381c5a35fc0c04edb71c8dc (patch) | |
| tree | b55a055ad5ed52991460c0296070501dfe2f7048 | |
| parent | 9950672a28ac65e1bdffab6e763c824d9a7573a4 (diff) | |
| download | niri-00806d1f082d19728381c5a35fc0c04edb71c8dc.tar.gz niri-00806d1f082d19728381c5a35fc0c04edb71c8dc.tar.bz2 niri-00806d1f082d19728381c5a35fc0c04edb71c8dc.zip | |
Replace unwrap() with a check and an error message
I just crashed here somehow.
| -rw-r--r-- | src/handlers/xdg_shell.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/handlers/xdg_shell.rs b/src/handlers/xdg_shell.rs index d99fbdf0..a99b344f 100644 --- a/src/handlers/xdg_shell.rs +++ b/src/handlers/xdg_shell.rs @@ -158,11 +158,18 @@ impl XdgShellHandler for State { return; } - let (window, output) = self + let win_out = self .niri .layout - .find_window_and_output(surface.wl_surface()) - .unwrap(); + .find_window_and_output(surface.wl_surface()); + + let Some((window, output)) = win_out else { + // I have no idea how this can happen, but I saw it happen once, in a weird interaction + // involving laptop going to sleep and resuming. + error!("toplevel missing from both unmapped_windows and layout"); + return; + }; + self.niri.layout.remove_window(&window); self.niri.queue_redraw(output); } |
