aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-09-21 07:08:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-09-21 07:10:48 +0000
commite2aeb7f3361b87e61a8bc5f478bb2dab056b1ac4 (patch)
tree4bc240eab68104853f37e53db6de0ebacaf31bc4 /render.c
parentrender: add missing include, limits.h (diff)
render: xcursor_is_valid(): don't crash when there's no theme loaded
When trying to set a custom cursor shape, we first validate it. This is done by checking against known server-side names, and then trying to load the cursor from the client side cursor theme. But, if we're using server side names, there is no theme loaded, and foot crashed. Fix by checking if we have a theme loaded, and if not, fail the cursor shape name validation.
Diffstat (limited to 'render.c')
-rw-r--r--render.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/render.c b/render.c
index 3d1ce4ee..20c0490b 100644
--- a/render.c
+++ b/render.c
@@ -4722,6 +4722,8 @@ render_xcursor_is_valid(const struct seat *seat, const char *cursor)
{
if (cursor == NULL)
return false;
+ if (seat->pointer.theme == NULL)
+ return false;
return wl_cursor_theme_get_cursor(seat->pointer.theme, cursor) != NULL;
}