Only close rule file if it could be opened.

This commit is contained in:
juliusv 2013-01-25 03:32:46 +01:00
parent 5caa2333ab
commit 619aa97025

View file

@ -114,9 +114,9 @@ func LoadExprFromString(exprString string) (ast.Node, error) {
func LoadExprFromFile(fileName string) (ast.Node, error) {
exprReader, err := os.Open(fileName)
defer exprReader.Close()
if err != nil {
return nil, err
}
defer exprReader.Close()
return LoadExprFromReader(exprReader)
}