Skip to content

Commit

Permalink
analyzeRegexGroups should not have out of range error upon no match
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Apr 23, 2020
1 parent 7626f7d commit 09bc81e
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 09bc81e

Please sign in to comment.