mirror of
https://github.com/spf13/viper
synced 2025-05-06 20:27:17 +00:00
fix: WatchConfig leads to panic if OnConfigChange is not called
This commit is contained in:
parent
aafc9e6bc7
commit
34f98a8913
1 changed files with 4 additions and 1 deletions
5
viper.go
5
viper.go
|
@ -289,7 +289,10 @@ 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:
|
||||||
|
|
Loading…
Add table
Reference in a new issue