summaryrefslogtreecommitdiff
path: root/viewres.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 14:13:58 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 14:13:58 -0700
commit7c75ce13299af68b73563714ca366f891f6a9eb8 (patch)
tree19046d40daec50df078e2616e12b5768957a5b40 /viewres.c
parent73f73d21c22b0220403bc036c6175fb7c2bfafee (diff)
set_node_labels: move dereference of node to after the NULL check
Found by cppcheck: viewres.c:815:22: warning: Either the condition '!node' is redundant or there is possible null pointer dereference: node. [nullPointerRedundantCheck] ViewresData *d = VData(node); ^ viewres.c:817:9: note: Assuming that condition '!node' is not redundant if (!node) ^ viewres.c:815:22: note: Null pointer dereference ViewresData *d = VData(node); ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'viewres.c')
-rw-r--r--viewres.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/viewres.c b/viewres.c
index cb4e9e2..d53e220 100644
--- a/viewres.c
+++ b/viewres.c
@@ -812,10 +812,11 @@ set_node_labels(XmuWidgetNode *node, int depth)
{
Arg args[1];
XmuWidgetNode *child;
- ViewresData *d = VData(node);
+ ViewresData *d;
if (!node)
return;
+ d = VData(node);
XtSetArg(args[0], XtNlabel, (options.show_variable ?
node->label : XmuWnClassname(node)));
XtSetValues(d->instance, args, ONE);