Fix nil pointer on watch function (#568)

This commit is contained in:
Andrew Stuart 2018-09-28 00:53:21 -07:00
parent b5e8006cbe
commit a1b8372762
No known key found for this signature in database
GPG Key ID: D409317C5B5ACD4D
1 changed files with 3 additions and 1 deletions

View File

@ -289,9 +289,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)
}