]> git.lizzy.rs Git - go-fscache.git/blobdiff - cachekey.go
Fix nil access on GetInvalid
[go-fscache.git] / cachekey.go
index 7d059dafd6af6e7021eba048c606ed80c42e80d7..37f88b93039ede47cf6a60806a36a1483a70dbd7 100755 (executable)
@@ -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,