Skip to content

Commit e338789

Browse files
authored
Merge pull request #118 from dengsh12/nilpointer_fix
Fix nil pointer panic
2 parents a24726c + eaaaa89 commit e338789

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ func (p *parser) parse(parsing *Config, tokens <-chan NgxToken, ctx blockCtx, co
385385
// if the file pattern was explicit, nginx will check
386386
// that the included file can be opened and read
387387
if f, err := p.openFile(pattern); err != nil {
388-
defer f.Close()
389388
perr := &ParseError{
390389
What: err.Error(),
391390
File: &parsing.File,
@@ -399,6 +398,7 @@ func (p *parser) parse(parsing *Config, tokens <-chan NgxToken, ctx blockCtx, co
399398
return nil, perr
400399
}
401400
} else {
401+
defer f.Close()
402402
fnames = []string{pattern}
403403
}
404404
}

0 commit comments

Comments
 (0)