From c527863c5327123a43047bb61e7fdf5325177cbd Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Wed, 24 Mar 2021 11:30:43 +0200 Subject: Fix agent crash when executing data query with context and non-existing chart_label_key (#10844) --- web/api/web_api_v1.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index 72962f9b10..0d2a33538a 100644 --- a/web/api/web_api_v1.c +++ b/web/api/web_api_v1.c @@ -511,8 +511,10 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c rrdhost_unlock(host); if (likely(context_param_list && context_param_list->rd)) // Just set the first one st = context_param_list->rd->rrdset; - else - sql_build_context_param_list(&context_param_list, host, context, NULL); + else { + if (!chart_label_key) + sql_build_context_param_list(&context_param_list, host, context, NULL); + } } else { st = rrdset_find(host, chart); -- cgit v1.2.3