diff options
author | Simon Ser <contact@emersion.fr> | 2021-09-07 08:38:48 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-07 10:27:46 +0200 |
commit | 88919464efb5d43cc695a2609543d4281fababaf (patch) | |
tree | 9be20d771f87bc53ae23c03ffdd879a8886499b5 | |
parent | ba0525c5c08b31ade48368df4d2fd1bbefd1304a (diff) |
surface: fix abort on NULL buffer attach
Fixes: ba0525c5c08b ("surface: drop wlr_surface_state.buffer_resource")
Closes: https://github.com/swaywm/wlroots/issues/3173
-rw-r--r-- | types/wlr_surface.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c index dbc78f25..a61498fe 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -42,10 +42,13 @@ static void surface_handle_attach(struct wl_client *client, struct wl_resource *buffer_resource, int32_t dx, int32_t dy) { struct wlr_surface *surface = wlr_surface_from_resource(resource); - struct wlr_buffer *buffer = wlr_buffer_from_resource(buffer_resource); - if (buffer == NULL) { - wl_resource_post_error(buffer_resource, 0, "unknown buffer type"); - return; + struct wlr_buffer *buffer = NULL; + if (buffer_resource != NULL) { + buffer = wlr_buffer_from_resource(buffer_resource); + if (buffer == NULL) { + wl_resource_post_error(buffer_resource, 0, "unknown buffer type"); + return; + } } surface->pending.committed |= WLR_SURFACE_STATE_BUFFER; |