aboutsummaryrefslogtreecommitdiff
path: root/src/core/stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/stats.c')
-rw-r--r--src/core/stats.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/stats.c b/src/core/stats.c
index f9de055e..50f24e29 100644
--- a/src/core/stats.c
+++ b/src/core/stats.c
@@ -1,5 +1,5 @@
//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2022 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -463,7 +463,7 @@ nng_stat *
nng_stat_find_scope(nng_stat *stat, const char *name, int id)
{
nng_stat *child;
- if (stat == NULL) {
+ if (stat == NULL || stat->s_info->si_type != NNG_STAT_SCOPE) {
return (NULL);
}
if ((stat->s_val.sv_id == id) &&
@@ -473,7 +473,7 @@ nng_stat_find_scope(nng_stat *stat, const char *name, int id)
}
NNI_LIST_FOREACH (&stat->s_children, child) {
nng_stat *result;
- if ((result = nng_stat_find(child, name)) != NULL) {
+ if ((result = nng_stat_find_scope(child, name, id)) != NULL) {
return (result);
}
}