From 1b92a4758da281cd19121049e7e3d10a793d2650 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Thu, 9 May 2024 00:20:09 -0400 Subject: [PATCH] Fix copy and paste --- window/src/os/wayland/copy_and_paste.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/window/src/os/wayland/copy_and_paste.rs b/window/src/os/wayland/copy_and_paste.rs index fce9b75e7bab..958321a94958 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 }