From 6258bb8183757d12ef2260ac4a18a7665c0ca4c4 Mon Sep 17 00:00:00 2001 From: Chris Howey Date: Sat, 19 Oct 2013 10:48:14 -0500 Subject: [PATCH] Fixes issue #70 Not exactly the best fix, but it'll do. --- fsnotify_bsd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index 5d909e5..9f7dbbf 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -349,7 +349,7 @@ func (w *Watcher) readEvents() { fileEvent.Name = w.paths[int(watchEvent.Ident)] fileInfo := w.finfo[int(watchEvent.Ident)] w.pmut.Unlock() - if fileInfo.IsDir() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && !fileEvent.IsDelete() { // Double check to make sure the directory exist. This can happen when // we do a rm -fr on a recursively watched folders and we receive a // modification event first but the folder has been deleted and later @@ -360,7 +360,7 @@ func (w *Watcher) readEvents() { } } - if fileInfo.IsDir() && fileEvent.IsModify() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && fileEvent.IsModify() && !fileEvent.IsDelete() { w.sendDirectoryChangeEvents(fileEvent.Name) } else { // Send the event on the events channel