From 215b8ee1d3231dd34a9e8002832cd028a6728dc7 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Fri, 17 Jun 2022 20:45:41 -0400 Subject: cppcheck (revise IsDescendant() to fix possible null-dereference) Signed-off-by: Thomas E. Dickey --- src/Destroy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.1