mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-09-03 00:47:17 +00:00
Merge pull request #578 from replicatedhq/emosbaugh/sc-48809/analyze-api-fromanalyzerresult-invalid-memory
filter nil analyzer results to prevent panic
This commit is contained in:
@@ -38,8 +38,11 @@ func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analy
|
||||
continue
|
||||
}
|
||||
|
||||
if analyzeResult != nil {
|
||||
analyzeResults = append(analyzeResults, analyzeResult...)
|
||||
// Filter nil results to prevent panic
|
||||
for _, r := range analyzeResult {
|
||||
if r != nil {
|
||||
analyzeResults = append(analyzeResults, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ func FromAnalyzerResult(input []*analyze.AnalyzeResult) []*Result {
|
||||
|
||||
result := make([]*Result, 0)
|
||||
for _, i := range input {
|
||||
// Continue on nil result to prevent panic
|
||||
if i == nil {
|
||||
continue
|
||||
}
|
||||
name := reg.ReplaceAllString(strings.ToLower(i.Title), ".")
|
||||
r := &Result{
|
||||
Meta: Meta{
|
||||
|
||||
Reference in New Issue
Block a user