From 030bc46e30055348cde7bf3e0e763438b17abbf9 Mon Sep 17 00:00:00 2001 From: Sean Estabrooks Date: Wed, 4 Sep 2024 09:00:52 -0400 Subject: [PATCH] Avoid potential panic, when starting in Wayland. As per the documentation for the OutputState info method: /// This may be none if the output has been destroyed or the /// compositor has not sent information about the output yet. Unwrapping its return has lead to crashes at startup, which to the user can appear as WezTerm refusing to start. --- window/src/os/wayland/connection.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/window/src/os/wayland/connection.rs b/window/src/os/wayland/connection.rs index d657374b1..80b1eb011 100644 --- a/window/src/os/wayland/connection.rs +++ b/window/src/os/wayland/connection.rs @@ -204,7 +204,10 @@ impl ConnectionOps for WaylandConnection { let output_state = &self.wayland_state.borrow().output; for output in output_state.outputs() { - let info = output_state.info(&output).unwrap(); + let info = match output_state.info(&output) { + Some(i) => i, + None => continue, + }; let name = match info.name { Some(n) => n.clone(), None => format!("{} {}", info.model, info.make),