Fix nil pointer on watch function (#568)

This commit is contained in:
Andrew Stuart 2018-09-28 00:53:21 -07:00 committed by GitHub
parent 3171ef9a22
commit 2c12c60302
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -306,7 +306,9 @@ func (v *Viper) WatchConfig() {
if err != nil { if err != nil {
log.Println("error:", err) log.Println("error:", err)
} }
v.onConfigChange(event) if v.onConfigChange != nil {
v.onConfigChange(event)
}
} }
} }
case err := <-watcher.Errors: case err := <-watcher.Errors: