Merge pull request #182 from replicatedhq/laverya/no-regex-panic-when-not-found

analyzeRegexGroups should not have out of range error upon no match
This commit is contained in:
Andrew Lavery
2020-04-23 15:29:23 -04:00
committed by GitHub
+1 -1
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]
}
}