Skip to content

Commit

Permalink
Fix null pointer error
Browse files Browse the repository at this point in the history
Add a condition to check for null pointer error if the res value is no present

Signed-off-by: DongYoung Kim <[email protected]>
  • Loading branch information
kwx4957 committed Sep 5, 2024
1 parent fdb1371 commit 31059dd
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,10 @@ func (c *ChaosExperimentHandler) GetExperimentStats(ctx context.Context, project
TotalExpCategorizedByResiliencyScore: nil,
}

if len(res) == 0 {
return result, nil
}

if len(res[0].TotalExperiments) > 0 {
result.TotalExperiments = res[0].TotalExperiments[0].Count
}
Expand Down

0 comments on commit 31059dd

Please sign in to comment.