From 6762b323fe8119acfcf1b6649b6a7f58560a9bab Mon Sep 17 00:00:00 2001 From: Valentin Flaux Date: Wed, 31 Aug 2022 11:09:17 +0200 Subject: [PATCH] Fix: panic in datadog scaler Signed-off-by: Valentin Flaux --- CHANGELOG.md | 1 + pkg/scalers/datadog_scaler.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed5849b2eb4..df4a491578b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md ### Fixes - **General:** Metrics endpoint returns correct HPA values ([#3554](https://github.com/kedacore/keda/issues/3554)) +- **Datadog Scaler:** Fix: panic in datadog scaler ([#3448](https://github.com/kedacore/keda/issues/3448)) ### Deprecations diff --git a/pkg/scalers/datadog_scaler.go b/pkg/scalers/datadog_scaler.go index 559e3f47198..f3c2ab131a6 100644 --- a/pkg/scalers/datadog_scaler.go +++ b/pkg/scalers/datadog_scaler.go @@ -286,7 +286,7 @@ func (s *datadogScaler) getQueryResult(ctx context.Context) (float64, error) { points := series[0].GetPointlist() index := len(points) - 1 - if len(points) == 0 || len(points[index]) < 2 { + if len(points) == 0 || len(points[index]) < 2 || points[index][1] == nil { if !s.metadata.useFiller { return 0, fmt.Errorf("no Datadog metrics returned for the given time window") }