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
3
viper.go
3
viper.go
|
@ -289,9 +289,12 @@ 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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue