diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-10 14:13:58 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-10 14:13:58 -0700 |
commit | 7c75ce13299af68b73563714ca366f891f6a9eb8 (patch) | |
tree | 19046d40daec50df078e2616e12b5768957a5b40 | |
parent | 73f73d21c22b0220403bc036c6175fb7c2bfafee (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>
-rw-r--r-- | viewres.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |