shell-screenshot: Avoid a crash when the cursor texture is NULL

Analogously to commit 2a7f9f70b8 for the
screen recorder, as a wayland compositor, the cursor texture might not
exist.

https://bugzilla.gnome.org/show_bug.cgi?id=771656
This commit is contained in:
Rui Matos 2016-09-19 15:34:03 +02:00
parent c9a528025c
commit ff814df03a

View File

@ -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);