Browse Source

Prevent processing empty line at the end of file

Brendan Abolivier 7 years ago
parent
commit
55d8603b27
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/metrics-alerting/config/config.go

+ 4
- 1
src/metrics-alerting/config/config.go View File

@@ -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 {