aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-07-01 15:03:55 +0100
committeremersion <contact@emersion.fr>2018-07-04 19:12:18 +0100
commit68c133da2fb49f4b7c26aacd49f535ef93d27116 (patch)
tree90d7f8fa766d96c810a12ca80257ab0f000f561f
parent6f0eb11024e364df530b134e572e4943f3c4e76d (diff)
surface: fix crash on NULL commit
-rw-r--r--types/wlr_surface.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index 57732649..5c594889 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -142,8 +142,12 @@ static void surface_set_input_region(struct wl_client *client,
static void surface_state_finalize(struct wlr_surface *surface,
struct wlr_surface_state *state) {
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
- wlr_buffer_get_resource_size(state->buffer, surface->renderer,
- &state->buffer_width, &state->buffer_height);
+ if (state->buffer != NULL) {
+ wlr_buffer_get_resource_size(state->buffer, surface->renderer,
+ &state->buffer_width, &state->buffer_height);
+ } else {
+ state->buffer_width = state->buffer_height = 0;
+ }
}
int width = state->buffer_width / state->scale;