Don't panic on unknown cursor style on x11 (cherry-pick #14264) (#14273)

gcp-cherry-pick-bot[bot] and Conrad Irwin created

Cherry-picked Don't panic on unknown cursor style on x11 (#14264)

Release Notes:

- linux: Fixed a panic if we request a cursor style your system doesn't
support

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>

Change summary

crates/gpui/src/platform/linux/x11/client.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Detailed changes

crates/gpui/src/platform/linux/x11/client.rs 🔗

@@ -1154,10 +1154,13 @@ impl LinuxClient for X11Client {
         let cursor = match state.cursor_cache.get(&style) {
             Some(cursor) => *cursor,
             None => {
-                let cursor = state
+                let Some(cursor) = state
                     .cursor_handle
                     .load_cursor(&state.xcb_connection, &style.to_icon_name())
-                    .expect("failed to load cursor");
+                    .log_err()
+                else {
+                    return;
+                };
                 state.cursor_cache.insert(style, cursor);
                 cursor
             }