Skip to content

Commit

Permalink
Merge pull request #182 from replicatedhq/laverya/no-regex-panic-when…
Browse files Browse the repository at this point in the history
…-not-found

analyzeRegexGroups should not have out of range error upon no match
  • Loading branch information
laverya authored Apr 23, 2020
2 parents 7626f7d + 09bc81e commit 33580e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/analyze/text_analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func analyzeRegexGroups(pattern string, collected []byte, outcomes []*troublesho

foundMatches := map[string]string{}
for i, name := range re.SubexpNames() {
if i != 0 && name != "" {
if i != 0 && name != "" && len(match) > i {
foundMatches[name] = match[i]
}
}
Expand Down

0 comments on commit 33580e9

Please sign in to comment.