Skip to content

Commit

Permalink
check for nil values and 0 jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
fishkerez committed Sep 14, 2023
1 parent 3f1a76d commit 28d73bf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/orchestrator/scanestimationwatcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,18 @@ func updateTotalScanTimeWithParallelScans(scanEstimation *models.ScanEstimation)
return fmt.Errorf("empty scan template")
}

if scanEstimation.Summary == nil {
return fmt.Errorf("empty summary")
}

if scanEstimation.Summary.JobsCompleted == nil {
return fmt.Errorf("jobsCompleted is not set")
}

if *scanEstimation.Summary.JobsCompleted == 0 {
return fmt.Errorf("0 completed jobs in summary")
}

maxParallelScanners := utils.ValueOrZero(scanEstimation.ScanTemplate.MaxParallelScanners)

if maxParallelScanners > 1 {
Expand Down

0 comments on commit 28d73bf

Please sign in to comment.