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

View File

@ -127,11 +127,13 @@ func (c *Config) Validate() error {
} }
w := &interpolationWalker{F: fn} w := &interpolationWalker{F: fn}
if err := reflectwalk.Walk(v.Default, w); err == nil { if v.Default != nil {
if interp { if err := reflectwalk.Walk(v.Default, w); err == nil {
errs = append(errs, fmt.Errorf( if interp {
"Variable '%s': cannot contain interpolations", errs = append(errs, fmt.Errorf(
v.Name)) "Variable '%s': cannot contain interpolations",
v.Name))
}
} }
} }
} }