Replace unwrap() with a check and an error message

I just crashed here somehow.
This commit is contained in:
Ivan Molodetskikh
2023-11-10 20:09:28 +04:00
parent 9950672a28
commit 00806d1f08
+10 -3
View File
@@ -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);
}