analyzeRegexGroups should not have out of range error upon no match

This commit is contained in:
Andrew Lavery
2020-04-23 15:26:01 -04:00
parent 7626f7d7d7
commit 09bc81e144

View File

@@ -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]
}
}