From 1a5f0c34ff4a160e586c69be5e1854c040296634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 15 Aug 2013 14:15:18 -0700 Subject: [PATCH] window: Fix logic for looking up widget default cursor We may deref a NULL pointer if there is no grab and no focus widget. --- clients/window.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/clients/window.c b/clients/window.c index d701889d..e9b6a5ea 100644 --- a/clients/window.c +++ b/clients/window.c @@ -2911,12 +2911,15 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, widget = input->grab; else widget = input->focus_widget; - if (widget && widget->motion_handler) - cursor = widget->motion_handler(input->focus_widget, - input, time, sx, sy, - widget->user_data); - else - cursor = input->focus_widget->default_cursor; + if (widget) { + if (widget->motion_handler) + cursor = widget->motion_handler(input->focus_widget, + input, time, sx, sy, + widget->user_data); + else + cursor = widget->default_cursor; + } else + cursor = CURSOR_LEFT_PTR; input_set_pointer_image(input, cursor); }