#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 <wez@wezfurlong.org>
This commit is contained in:
Gracjan GóreckiandWez Furlong authored and GitHub committed 2024-09-14 10:48:35 -07:00
1 parent fed0e3926e
commit 137a97bf65
1 file changed
+3 -6
+3 -6
View File
@@ -102,12 +102,9 @@ impl CopyAndPaste {
impl WaylandState {
pub(super) fn resolve_copy_and_paste(&mut self) -> Option<Arc<Mutex<CopyAndPaste>>> {
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))
}
}