]> git.lizzy.rs Git - go-fscache.git/commitdiff
Fix nil access on GetInvalid
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Tue, 16 Jul 2013 22:53:01 +0000 (19:53 -0300)
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>
Tue, 16 Jul 2013 22:53:01 +0000 (19:53 -0300)
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,