surface: fix crash on NULL commit

This commit is contained in:
emersion 2018-07-01 15:03:55 +01:00
parent 6f0eb11024
commit 68c133da2f
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -142,8 +142,12 @@ static void surface_set_input_region(struct wl_client *client,
static void surface_state_finalize(struct wlr_surface *surface, static void surface_state_finalize(struct wlr_surface *surface,
struct wlr_surface_state *state) { struct wlr_surface_state *state) {
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) { if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
if (state->buffer != NULL) {
wlr_buffer_get_resource_size(state->buffer, surface->renderer, wlr_buffer_get_resource_size(state->buffer, surface->renderer,
&state->buffer_width, &state->buffer_height); &state->buffer_width, &state->buffer_height);
} else {
state->buffer_width = state->buffer_height = 0;
}
} }
int width = state->buffer_width / state->scale; int width = state->buffer_width / state->scale;