summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-06-17 20:45:41 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2022-06-18 06:36:55 -0400
commit215b8ee1d3231dd34a9e8002832cd028a6728dc7 (patch)
treebb649c8d5c61a6196f120d01c7d742aa698f78c4
parent806aefc8c6175b6252a300905a327e9d60939af7 (diff)
cppcheck (revise IsDescendant() to fix possible null-dereference)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/Destroy.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Destroy.c b/src/Destroy.c
index 9595bed..deffc8f 100644
--- a/src/Destroy.c
+++ b/src/Destroy.c
@@ -195,11 +195,10 @@ Phase2Destroy(register Widget widget)
static Boolean
IsDescendant(Widget widget, const Widget root)
{
- while ((widget = XtParent(widget)) != root) {
- if (widget == NULL)
- return False;
+ while (widget != NULL && (widget = XtParent(widget)) != root) {
+ ;
}
- return True;
+ return (widget != NULL) ? True : False;
}
static void