From 978bd4e2c4801ce4f96ef361c50432aa1f39b7fe Mon Sep 17 00:00:00 2001 From: poornas Date: Thu, 27 Feb 2020 10:57:00 -0800 Subject: [PATCH] check cacheControl not nil before access (#9055) Fixes: #9053 --- cmd/disk-cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/disk-cache.go b/cmd/disk-cache.go index 752f0c753..6c88dd2e1 100644 --- a/cmd/disk-cache.go +++ b/cmd/disk-cache.go @@ -206,7 +206,7 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string c.incHitsToMeta(ctx, dcache, bucket, object, cacheReader.ObjInfo.Size, cacheReader.ObjInfo.ETag) return cacheReader, nil } - if cc.noStore { + if cc != nil && cc.noStore { c.cacheStats.incMiss() bReader, err := c.GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts) bReader.ObjInfo.CacheLookupStatus = CacheHit @@ -390,7 +390,7 @@ func (c *cacheObjects) CopyObject(ctx context.Context, srcBucket, srcObject, dst // if currently cached, evict old entry and revert to backend. if cachedObjInfo, _, cerr := dcache.Stat(ctx, srcBucket, srcObject); cerr == nil { cc := cacheControlOpts(cachedObjInfo) - if !cc.isStale(cachedObjInfo.ModTime) { + if cc == nil || !cc.isStale(cachedObjInfo.ModTime) { dcache.Delete(ctx, srcBucket, srcObject) } }