From 580876751f2d95a76b9ab1795ffe5847c0d5fed8 Mon Sep 17 00:00:00 2001 From: Emad Mohamadi Date: Wed, 31 May 2023 13:50:16 +0200 Subject: [PATCH] Fix panic on number of args in fallbackSeries func --- pkg/expr/functions/fallbackSeries/function.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/expr/functions/fallbackSeries/function.go b/pkg/expr/functions/fallbackSeries/function.go index debec7aa..d78535f6 100644 --- a/pkg/expr/functions/fallbackSeries/function.go +++ b/pkg/expr/functions/fallbackSeries/function.go @@ -33,6 +33,10 @@ func (f *fallbackSeries) Do(ctx context.Context, e parser.Expr, from, until int3 Takes a wildcard seriesList, and a second fallback metric. If the wildcard does not match any series, draws the fallback metric. */ + if len(e.Args()) < 2 { + return nil, parser.ErrMissingArgument + } + seriesList, err := helper.GetSeriesArg(ctx, e.Args()[0], from, until, values, getTargetData) fallback, errFallback := helper.GetSeriesArg(ctx, e.Args()[1], from, until, values, getTargetData) if errFallback != nil && err != nil {