check tat control is not nil

This commit is contained in:
DanielGrunbergerCA
2022-04-25 12:14:48 +03:00
parent 8d4bae06bc
commit b72e2610ca
@@ -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