From ff814df03a8126d9e8c719c135dfee5368a472b8 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 19 Sep 2016 15:34:03 +0200 Subject: [PATCH] shell-screenshot: Avoid a crash when the cursor texture is NULL Analogously to commit 2a7f9f70b836aee8605876186ff75d001d8ce63d for the screen recorder, as a wayland compositor, the cursor texture might not exist. https://bugzilla.gnome.org/show_bug.cgi?id=771656 --- src/shell-screenshot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index 089828e05..0e5e69d8f 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -263,6 +263,10 @@ _draw_cursor_image (MetaCursorTracker *tracker, int x, y; int xhot, yhot; + texture = meta_cursor_tracker_get_sprite (tracker); + if (!texture) + return; + screenshot_region = cairo_region_create_rectangle (&area); meta_cursor_tracker_get_pointer (tracker, &x, &y, NULL); @@ -272,7 +276,6 @@ _draw_cursor_image (MetaCursorTracker *tracker, return; } - texture = meta_cursor_tracker_get_sprite (tracker); meta_cursor_tracker_get_hot (tracker, &xhot, &yhot); width = cogl_texture_get_width (texture); height = cogl_texture_get_height (texture);