From: Diogo Franco (Kovensky) Date: Tue, 16 Jul 2013 22:53:01 +0000 (-0300) Subject: Fix nil access on GetInvalid X-Git-Tag: v0.0.1~4 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a27fc1479a0597dd11dfe733abb7724ef0d9df93;p=go-fscache.git Fix nil access on GetInvalid --- diff --git a/cachekey.go b/cachekey.go index 7d059da..37f88b9 100755 --- a/cachekey.go +++ b/cachekey.go @@ -54,8 +54,10 @@ var invalidPath = []CacheKey{".invalid"} func (cd *CacheDir) GetInvalid(key ...CacheKey) (ts time.Time) { invKey := append(invalidPath, key...) - stat, _ := cd.Stat(invKey...) - return stat.ModTime() + if stat, err := cd.Stat(invKey...); err == nil { + ts = stat.ModTime() + } + return } // Checks if the given key is not marked as invalid, or if it is,