Avoid crashing if entered surface's window is not a known window

Not sure how this even happens, but should fix #88
This commit is contained in:
Shawn Wallace 2025-01-07 21:27:27 -05:00
parent 94da1af753
commit b699ce62a1

View file

@ -127,11 +127,7 @@ impl SurfaceData {
self.output_key = Some(key); self.output_key = Some(key);
debug!("{} entered {}", self.server.id(), output.server.id()); debug!("{} entered {}", self.server.id(), output.server.id());
let windows = &mut state.windows; let windows = &mut state.windows;
if let Some(win_data) = self if let Some(win_data) = self.window.as_ref().and_then(|win| windows.get_mut(win)) {
.window
.as_ref()
.map(|win| windows.get_mut(&win).unwrap())
{
let (x, y) = match output.position { let (x, y) = match output.position {
OutputPosition::Xdg { x, y } => (x, y), OutputPosition::Xdg { x, y } => (x, y),
OutputPosition::Wl { x, y } => (x, y), OutputPosition::Wl { x, y } => (x, y),