[coverity] 1543074 Dereference before null check

This commit is contained in:
akallabeth 2024-04-12 10:28:35 +02:00 committed by akallabeth
parent d18585b8cc
commit 0d09ae9ad4

View File

@ -818,6 +818,8 @@ static void pointer_handle_motion(void* data, struct wl_pointer* pointer, uint32
assert(input);
UwacWindow* window = input->pointer_focus;
if (!window || !window->display)
return;
int scale = window->display->actual_scale;
int sx_i = wl_fixed_to_int(sx_w) * scale;
@ -825,7 +827,7 @@ static void pointer_handle_motion(void* data, struct wl_pointer* pointer, uint32
double sx_d = wl_fixed_to_double(sx_w) * scale;
double sy_d = wl_fixed_to_double(sy_w) * scale;
if (!window || (sx_i < 0) || (sy_i < 0))
if ((sx_i < 0) || (sy_i < 0))
return;
input->sx = sx_d;