瀏覽代碼

Prevent processing empty line at the end of file

Brendan Abolivier 7 年之前
父節點
當前提交
55d8603b27
簽署人: Brendan Abolivier <contact@brendanabolivier.com> GPG 金鑰 ID: 8EF1500759F70623
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      src/metrics-alerting/config/config.go

+ 4
- 1
src/metrics-alerting/config/config.go 查看文件

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