xwayland: fix error path when modifier is not supported

When the modifier is not supported by the compositor, and the
DMA-BUF contains multiple planes, xwl_pixmap->buffer is NULL.
Avoid crashing when calling wl_buffer_add_listener().

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2023-02-27 14:41:37 +01:00 committed by Olivier Fourdan
parent 24171bb710
commit 76a329e55c

View File

@ -446,8 +446,9 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap)
close(prime_fds[i]);
/* Add our listener now */
wl_buffer_add_listener(xwl_pixmap->buffer,
&xwl_glamor_gbm_buffer_listener, pixmap);
if (xwl_pixmap->buffer)
wl_buffer_add_listener(xwl_pixmap->buffer,
&xwl_glamor_gbm_buffer_listener, pixmap);
return xwl_pixmap->buffer;
}