mirror of
https://github.com/hikhvar/mqtt2prometheus.git
synced 2026-08-23 21:16:15 +00:00
Merge pull request #47 from chr4/feat/topic-resillience
Make GroupValue() more resilient
This commit is contained in:
@@ -61,7 +61,7 @@ func (rf *Regexp) GroupValue(s string, groupName string) string {
|
||||
match := rf.r.FindStringSubmatch(s)
|
||||
groupValues := make(map[string]string)
|
||||
for i, name := range rf.r.SubexpNames() {
|
||||
if name != "" {
|
||||
if len(match) > i && name != "" {
|
||||
groupValues[name] = match[i]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user