From e4d6c94e656ad28b753bb13c9cb71784987159bd Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Sat, 8 Sep 2018 10:41:56 -0300 Subject: [PATCH] Fix invalid memory error after deleting a watched file Closes #3 --- watcher.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/watcher.go b/watcher.go index c872237..738e84d 100644 --- a/watcher.go +++ b/watcher.go @@ -138,6 +138,12 @@ func (w *watcher) scanChange(watchPath string) (string, error) { } 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 if w.defaultIgnore { // check for hidden files and directories