summaryrefslogtreecommitdiff
path: root/src/menus.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-11 22:41:56 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-12 19:03:47 -0700
commit70a7f34dfc4d7ea4f7425b9a7359a08a35752bb0 (patch)
tree2458ff1e015b8f21856d5f37b6db364ae0dcca0e /src/menus.c
parenta898b136729660a33d60b317ccb839f6e0428201 (diff)
Add extra sanity checking to avoid possible NULL dereferences
menus.c:569:10: warning: Access to field 'func' results in a dereference of a null pointer (loaded from variable 'ActiveItem') if (ActiveItem->func != F_TITLE && !ActiveItem->state) ^~~~~~~~~~ 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/menus.c')
-rw-r--r--src/menus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/menus.c b/src/menus.c
index 395426f..1bf32bf 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -569,7 +569,7 @@ UpdateMenu()
if (!done)
{
ActiveItem = mi;
- if (ActiveItem->func != F_TITLE && !ActiveItem->state)
+ if (ActiveItem && ActiveItem->func != F_TITLE && !ActiveItem->state)
{
ActiveItem->state = 1;
PaintEntry(ActiveMenu, ActiveItem, False);
@@ -577,7 +577,7 @@ UpdateMenu()
}
/* now check to see if we were over the arrow of a pull right entry */
- if (ActiveItem->func == F_MENU &&
+ if (ActiveItem && ActiveItem->func == F_MENU &&
((ActiveMenu->width - x) < (ActiveMenu->width >> 1)))
{
MenuRoot *save = ActiveMenu;