mirror of
https://github.com/spf13/viper
synced 2025-05-06 12:17:18 +00:00
Add check to see if v.onConfigChange is nil before calling
This commit is contained in:
parent
5ed0fc31f7
commit
b80be0b847
1 changed files with 3 additions and 1 deletions
2
viper.go
2
viper.go
|
@ -262,9 +262,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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue