Compare commits

...

1 Commits

Author SHA1 Message Date
Andrew Stuart a8d2f21f14
Fix nil pointer on watch function 2018-09-27 23:34:43 -07:00
1 changed files with 3 additions and 1 deletions

View File

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