wayland backend seat: fix NULL output check

The test was done after dereferencing output in pointer_handle_enter,
just move it up one line.
No reason pointer_handle_leave would not need the check if enter needs
it, add it there.

Found through static analysis.
This commit is contained in:
Dominique Martinet 2018-06-30 10:03:26 +09:00
parent f0d455f088
commit 4f7b1382d4
1 changed files with 2 additions and 3 deletions

View File

@ -38,10 +38,8 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
} }
struct wlr_wl_output *output = wl_surface_get_user_data(surface); struct wlr_wl_output *output = wl_surface_get_user_data(surface);
assert(output);
struct wlr_wl_pointer *pointer = output_get_pointer(output); struct wlr_wl_pointer *pointer = output_get_pointer(output);
if (output == NULL) {
return;
}
output->enter_serial = serial; output->enter_serial = serial;
backend->current_pointer = pointer; backend->current_pointer = pointer;
@ -56,6 +54,7 @@ static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
} }
struct wlr_wl_output *output = wl_surface_get_user_data(surface); struct wlr_wl_output *output = wl_surface_get_user_data(surface);
assert(output);
output->enter_serial = 0; output->enter_serial = 0;
if (backend->current_pointer == NULL || if (backend->current_pointer == NULL ||