Check return value of wl_cursor functions
This patch adds checks for themes and cursors returned by wl_cursor functions.
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 238946b..7d9e01b 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -968,7 +968,8 @@
image = input->compositor->cursor->images[0];
buffer = wl_cursor_image_get_buffer(image);
-
+ if (!buffer)
+ return;
wl_pointer_set_cursor(input->parent.pointer, input->enter_serial,
input->parent.cursor.surface,
@@ -1428,6 +1429,10 @@
weston_config_section_get_int(s, "cursor-size", &size, 32);
c->cursor_theme = wl_cursor_theme_load(theme, size, c->parent.shm);
+ if (!c->cursor_theme) {
+ fprintf(stderr, "could not load cursor theme\n");
+ return;
+ }
free(theme);