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
4
viper.go
4
viper.go
|
@ -262,7 +262,9 @@ 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