From b72e2610ca7bde6ad959906c2385df2ff8850b4e Mon Sep 17 00:00:00 2001 From: DanielGrunbergerCA Date: Mon, 25 Apr 2022 12:14:48 +0300 Subject: [PATCH] check tat control is not nil --- core/pkg/opaprocessor/processorhandlerutils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/pkg/opaprocessor/processorhandlerutils.go b/core/pkg/opaprocessor/processorhandlerutils.go index b2e569d7..8526bded 100644 --- a/core/pkg/opaprocessor/processorhandlerutils.go +++ b/core/pkg/opaprocessor/processorhandlerutils.go @@ -66,13 +66,15 @@ func mapControlToInfo(mapResourceToControls map[string][]string, infoMap map[str for resource, statusInfo := range infoMap { controlIDs := mapResourceToControls[resource] for _, controlID := range controlIDs { - resources := controlSummary.GetControl(reportsummary.EControlCriteriaID, controlID).NumberOfResources() - if resources != nil { + ctrl := controlSummary.GetControl(reportsummary.EControlCriteriaID, controlID) + if ctrl != nil { + resources := ctrl.NumberOfResources() // Check that there are no K8s resources too if isEmptyResources(resources) { controlToInfoMap[controlID] = statusInfo } } + } } return controlToInfoMap