NULL pointer dereference happens when input->focus_widget == NULL
and input->grab == NULL.

Signed-off-by: Mariusz Ceier <[email protected]>
---
 clients/window.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index cbfe12f..9933cb9 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -2819,14 +2819,17 @@ 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;
+               input_set_pointer_image(input, cursor);
+       }
 
-       input_set_pointer_image(input, cursor);
 }
 
 static void
-- 
1.8.3.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to