From 05a07126569fe2d2168ab3077a0891c4c872e389 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 10 Jun 2022 21:03:41 +0200 Subject: MotionNotify handler: only call generic handler if winwid != NULL Closes #656 --- src/events.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/events.c b/src/events.c index 81b7157..524ccad 100644 --- a/src/events.c +++ b/src/events.c @@ -681,16 +681,18 @@ static void feh_event_handle_MotionNotify(XEvent * ev) } else { while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); winwid = winwidget_get_from_window(ev->xmotion.window); - if ((winwid != NULL) && (winwid->type == WIN_TYPE_THUMBNAIL)) { - feh_thumbnail *thumbnail; - int x, y; - - x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; - y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; - thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); - feh_thumbnail_select(winwid, thumbnail); - } else { - feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + if (winwid != NULL) { + if (winwid->type == WIN_TYPE_THUMBNAIL) { + feh_thumbnail *thumbnail; + int x, y; + + x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; + y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; + thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); + feh_thumbnail_select(winwid, thumbnail); + } else { + feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + } } } return; -- cgit v1.2.3