1
0
Fork 0
mirror of https://github.com/spf13/viper synced 2025-08-18 16:41:54 +00:00

fix: WatchConfig leads to panic if OnConfigChange is not called

This commit is contained in:
EMayej Bee 2018-01-18 10:27:42 +08:00
commit 34f98a8913

View file

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