Skip to content

Commit

Permalink
fix(render): better handler empty buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
jtheoof committed Dec 29, 2019
1 parent e8d377f commit acf2379
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ static void render_buffer(cairo_t *cr, struct swappy_state *state) {

wl_list_for_each(output, &state->outputs, link) {
struct swappy_buffer *buffer = output->buffer;

if (output->buffer == NULL) {
g_warning(
"screencopy buffer is empty, cannot draw it onto the paint area");
continue;
}

cairo_format_t format = get_cairo_format(buffer->format);

g_assert(format != CAIRO_FORMAT_INVALID);
Expand Down Expand Up @@ -258,6 +265,9 @@ void render_state(struct swappy_state *state) {

cairo_set_source_rgb(cr, 1, 1, 1);

cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_paint(cr);

render_buffer(cr, state);
render_paints(cr, state);

Expand Down

0 comments on commit acf2379

Please sign in to comment.