From 1061e063be78f4e233d550649ce297b639193a9f Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 11 May 2011 22:27:21 -0700 Subject: Address a possible NULL pointer dereference menus.c:523:24: warning: Access to field 'w' results in a dereference of a null pointer (loaded from variable 'ActiveMenu') if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0) ^~~~~~~~~~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston Acked-by: Peter Hutterer --- src/menus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/menus.c') diff --git a/src/menus.c b/src/menus.c index bc688e6..34a3c8e 100644 --- a/src/menus.c +++ b/src/menus.c @@ -511,13 +511,16 @@ UpdateMenu() if (Event.type != MotionNotify) continue; + + if (!ActiveMenu) + continue; done = FALSE; XQueryPointer( dpy, ActiveMenu->w, &JunkRoot, &JunkChild, &x_root, &y_root, &x, &y, &JunkMask); /* if we haven't recieved the enter notify yet, wait */ - if (ActiveMenu && !ActiveMenu->entered) + if (!ActiveMenu->entered) continue; if (XFindContext(dpy, ActiveMenu->w, ScreenContext, &context_data) == 0) -- cgit v1.2.3