Fix nil pointer dereference (#1289)

This commit is contained in:
Jake Sanders 2020-03-03 13:54:56 +00:00 committed by GitHub
parent eebd69c995
commit beb5e80e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,9 @@ func (w *workersKV) Read(key string, opts ...store.ReadOption) ([]*store.Record,
}
record.Expiry = time.Until(time.Unix(expiryUnix, 0))
}
if w.cache != nil {
w.cache.Set(record.Key, record, cache.DefaultExpiration)
}
records = append(records, record)
}