From f4e3a1f9d1e0a3b6c5e44e5c689768a4039ac787 Mon Sep 17 00:00:00 2001 From: "taekyu.kang" Date: Thu, 23 May 2024 16:24:55 +0900 Subject: [PATCH] trivial. fix error for policyViolationTop5 --- internal/usecase/dashboard.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/usecase/dashboard.go b/internal/usecase/dashboard.go index 6c108171..2dae8e63 100644 --- a/internal/usecase/dashboard.go +++ b/internal/usecase/dashboard.go @@ -1073,6 +1073,10 @@ func (u *DashboardUsecase) GetPolicyViolationTop5(ctx context.Context, organizat warnCount := 0 dryrunCount := 0 for _, result := range pvcm.Data.Result { + if result.Value == nil || len(result.Value) <= 1 { + continue + } + switch policy := result.Metric.ViolationEnforcement; policy { case "": denyCount, _ = strconv.Atoi(result.Value[1].(string))