Fix invalid memory error after deleting a watched file

Closes #3
This commit is contained in:
Max Claus Nunes 2018-09-08 10:41:56 -03:00
parent 7f5268751f
commit e4d6c94e65
1 changed files with 6 additions and 0 deletions

View File

@ -138,6 +138,12 @@ func (w *watcher) scanChange(watchPath string) (string, error) {
} }
func (w *watcher) ignoreFile(path string, info os.FileInfo) bool { func (w *watcher) ignoreFile(path string, info os.FileInfo) bool {
// if a file has been deleted after gaper was watching it
// info will be nil in the other iterations
if info == nil {
return true
}
// check if preset ignore is enabled // check if preset ignore is enabled
if w.defaultIgnore { if w.defaultIgnore {
// check for hidden files and directories // check for hidden files and directories