summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2024-03-01 20:30:50 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2024-03-02 16:58:06 -0500
commita3fb321330ccb6d9dcd6fd3d41971cda3987527a (patch)
tree294eac395de900a2ad91f8ba8b49857c98067594
parent3841474f3ba6914b6909e29c5cf0c5e7207a69a7 (diff)
add check for null pointer, avoid dereferencing
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/MenuButton.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/MenuButton.c b/src/MenuButton.c
index face84c..a6b9302 100644
--- a/src/MenuButton.c
+++ b/src/MenuButton.c
@@ -211,7 +211,9 @@ PopupMenu(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal
int menu_x, menu_y, menu_width, menu_height, button_height;
Position button_x, button_y;
- temp = w;
+ if ((temp = w) == NULL)
+ return;
+
while(temp != NULL) {
menu = XtNameToWidget(temp, mbw->menu_button.menu_name);
if (menu == NULL)