From 137a97bf65546ab1dbea119db0c9e99ab852dca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gracjan=20G=C3=B3recki?= Date: Sat, 14 Sep 2024 19:48:35 +0200 Subject: [PATCH] #5518: handling panic in copy_and_paste.rs line 105 (#6004) * #5518: handling panic in copy_and_paste.rs line 105 Co-authored-by: Wez Furlong --- window/src/os/wayland/copy_and_paste.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/window/src/os/wayland/copy_and_paste.rs b/window/src/os/wayland/copy_and_paste.rs index fce9b75e7..ce309fbd3 100644 --- a/window/src/os/wayland/copy_and_paste.rs +++ b/window/src/os/wayland/copy_and_paste.rs @@ -102,12 +102,9 @@ 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)) - } else { - None - } + let active_surface_id = active_surface_id.as_ref()?; + let pending = self.surface_to_pending.get(&active_surface_id)?; + Some(Arc::clone(&pending.lock().unwrap().copy_and_paste)) } }