mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Replace unwrap() with a check and an error message
I just crashed here somehow.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user