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 <[email protected]>
---
 src/menus.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

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)
-- 
1.7.4.4


_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to