diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-11 22:27:21 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-05-12 19:03:40 -0700 |
commit | 1061e063be78f4e233d550649ce297b639193a9f (patch) | |
tree | 780800f112e54c2b91a22888882a0ff9ce1df6e4 /src | |
parent | bde0b06b465adb868d38d3721b95ea337bad8eb9 (diff) |
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 <jeremyhu@apple.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | 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) |