summaryrefslogtreecommitdiff
path: root/src/menus.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-06-05 11:26:31 +0200
committerMatthieu Herrb <matthieu.herrb@laas.fr>2011-06-05 11:26:31 +0200
commitb2365de9199c4779cceba2505bc8463e1740bb62 (patch)
tree5dcb8de470a1efdc71ce659723cf3e9b24d72d50 /src/menus.c
parentc066d43835faafd79531ee40a2fa575e596bed2f (diff)
parent70a7f34dfc4d7ea4f7425b9a7359a08a35752bb0 (diff)
Merge remote-tracking branch 'origin/master' into obsd
Diffstat (limited to 'src/menus.c')
-rw-r--r--src/menus.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/menus.c b/src/menus.c
index 9de036e..b58e036 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -58,6 +58,10 @@ in this Software without prior written authorization from The Open Group.
*
***********************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
#include <X11/Xos.h>
#include "twm.h"
@@ -507,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)
@@ -562,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);
@@ -570,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;
@@ -913,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;