summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-11 22:30:56 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-12 19:03:43 -0700
commita898b136729660a33d60b317ccb839f6e0428201 (patch)
treee48c8b970d2c0215308afc951b20bd7b3faec781 /src
parent1061e063be78f4e233d550649ce297b639193a9f (diff)
Add sanity checking to avoid a possible NULL dereference
menus.c:934:26: warning: Access to field 'fore' results in a dereference of a null pointer (loaded from variable 'cur') cur->hi_back = cur->fore = f3.pixel; ~~~ ^ 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/menus.c b/src/menus.c
index 34a3c8e..395426f 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -920,7 +920,7 @@ MakeMenu(MenuRoot *mr)
b3.flags = DoRed | DoGreen | DoBlue;
num -= 1;
- for (i = 0, cur = start->next; i < num; i++, cur = cur->next)
+ for (i = 0, cur = start->next; i < num && cur; i++, cur = cur->next)
{
f3.red += fred;
f3.green += fgreen;