diff --git a/window/src/os/wayland/copy_and_paste.rs b/window/src/os/wayland/copy_and_paste.rs index fce9b75e7ba..958321a9495 100644 --- a/window/src/os/wayland/copy_and_paste.rs +++ b/window/src/os/wayland/copy_and_paste.rs @@ -102,9 +102,12 @@ impl CopyAndPaste { impl WaylandState { pub(super) fn resolve_copy_and_paste(&mut self) -> Option>> { let active_surface_id = self.active_surface_id.borrow(); - let active_surface_id = active_surface_id.as_ref().unwrap(); - if let Some(pending) = self.surface_to_pending.get(&active_surface_id) { - Some(Arc::clone(&pending.lock().unwrap().copy_and_paste)) + if let Some(active_surface_id) = active_surface_id.as_ref() { + if let Some(pending) = self.surface_to_pending.get(&active_surface_id) { + Some(Arc::clone(&pending.lock().unwrap().copy_and_paste)) + } else { + None + } } else { None }