Fix nil pointer on watch function

This commit is contained in:
Andrew Stuart 2018-09-27 23:34:43 -07:00
parent 3171ef9a22
commit a8d2f21f14
No known key found for this signature in database
GPG key ID: D409317C5B5ACD4D

View file

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