config: only walk if non-nil

This commit is contained in:
Mitchell Hashimoto 2014-08-11 21:55:47 -07:00
parent 2fd545bca1
commit 3e3be5e2a3
1 changed files with 7 additions and 5 deletions

View File

@ -127,6 +127,7 @@ func (c *Config) Validate() error {
}
w := &interpolationWalker{F: fn}
if v.Default != nil {
if err := reflectwalk.Walk(v.Default, w); err == nil {
if interp {
errs = append(errs, fmt.Errorf(
@ -135,6 +136,7 @@ func (c *Config) Validate() error {
}
}
}
}
// Check for references to user variables that do not actually
// exist and record those errors.