Bläddra i källkod

Prevent processing empty line at the end of file

Brendan Abolivier 7 år sedan
förälder
incheckning
55d8603b27
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4
    1
      src/metrics-alerting/config/config.go

+ 4
- 1
src/metrics-alerting/config/config.go Visa fil

@@ -112,7 +112,10 @@ func (cfg *Config) loadData() error {
112 112
 					break
113 113
 				}
114 114
 
115
-				script.ScriptData[key] = append(script.ScriptData[key], line)
115
+				// Prevent processing empty line at the end of file
116
+				if len(line) > 0 {
117
+					script.ScriptData[key] = append(script.ScriptData[key], line)
118
+				}
116 119
 			}
117 120
 		}
118 121
 		for key, slice := range script.DataSource.Plain {