Fix crash when setting cursor on non-existent pointer

This commit is contained in:
V authored and Wez Furlong committed 2024-05-04 16:09:38 -07:00
1 parent 369fcb9928
commit 48fa4ca497
1 file changed
+5 -2
+5 -2
View File
@@ -1,5 +1,5 @@
use std::any::Any;
use std::cell::{RefCell, RefMut};
use std::cell::RefCell;
use std::cmp::max;
use std::convert::TryInto;
use std::io::Read;
@@ -912,7 +912,10 @@ impl WaylandWindowInner {
fn set_cursor(&mut self, cursor: Option<MouseCursor>) {
let conn = Connection::get().unwrap().wayland();
let state = conn.wayland_state.borrow_mut();
let pointer = RefMut::map(state, |s| s.pointer.as_mut().unwrap());
let pointer = match &state.pointer {
Some(pointer) => pointer,
None => return,
};
match cursor {
Some(cursor) => {