From 8ffcf546cf0a087acdb75c6d6432af3fae4abf4b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 4 Feb 2023 07:44:47 -0700 Subject: [PATCH] wayland: improve error when no seats have pointers I don't know why that might be the case, but this error is better than the unwrap. refs: https://github.com/wez/wezterm/issues/3050 --- window/src/os/wayland/connection.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/window/src/os/wayland/connection.rs b/window/src/os/wayland/connection.rs index 719a71d7b..344644709 100644 --- a/window/src/os/wayland/connection.rs +++ b/window/src/os/wayland/connection.rs @@ -128,6 +128,8 @@ impl WaylandConnection { } } } + let pointer = + pointer.ok_or_else(|| anyhow::anyhow!("no seats have an available pointer"))?; let seat_listener; { @@ -188,7 +190,7 @@ impl WaylandConnection { next_window_id: AtomicUsize::new(1), windows: RefCell::new(HashMap::new()), event_q: RefCell::new(event_q), - pointer: RefCell::new(pointer.unwrap()), + pointer: RefCell::new(pointer), seat_listener, mem_pool: RefCell::new(mem_pool), gl_connection: RefCell::new(None),