summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--database/contexts/query_scope.c3
-rw-r--r--web/api/queries/weights.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/database/contexts/query_scope.c b/database/contexts/query_scope.c
index c62d031c08..ae04f643f1 100644
--- a/database/contexts/query_scope.c
+++ b/database/contexts/query_scope.c
@@ -72,6 +72,9 @@ ssize_t query_scope_foreach_host(SIMPLE_PATTERN *scope_hosts_sp, SIMPLE_PATTERN
ssize_t query_scope_foreach_context(RRDHOST *host, const char *scope_contexts, SIMPLE_PATTERN *scope_contexts_sp,
SIMPLE_PATTERN *contexts_sp, foreach_context_cb_t cb, bool queryable_host, void *data) {
+ if(unlikely(!host->rrdctx.contexts))
+ return 0;
+
ssize_t added = 0;
RRDCONTEXT_ACQUIRED *rca = NULL;
diff --git a/web/api/queries/weights.c b/web/api/queries/weights.c
index c6a3393ec3..04f1d07ac3 100644
--- a/web/api/queries/weights.c
+++ b/web/api/queries/weights.c
@@ -1103,7 +1103,7 @@ static void rrdset_weights_multi_dimensional_value(struct query_weights_data *qw
ONEWAYALLOC *owa = onewayalloc_create(16 * 1024);
RRDR *r = rrd2rrdr(owa, query_target_create(&qtr));
- if(rrdr_rows(r) != 1 || !r->d)
+ if(rrdr_rows(r) != 1 || !r->d || r->d != r->internal.qt->query.used)
goto cleanup;
QUERY_VALUE qv = {