aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/cache/object_lru.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/cache/object_lru.go')
-rw-r--r--plumbing/cache/object_lru.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/plumbing/cache/object_lru.go b/plumbing/cache/object_lru.go
index 53d8b02..cd3712b 100644
--- a/plumbing/cache/object_lru.go
+++ b/plumbing/cache/object_lru.go
@@ -61,6 +61,11 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) {
c.actualSize += objSize
for c.actualSize > c.MaxSize {
last := c.ll.Back()
+ if last == nil {
+ c.actualSize = 0
+ break
+ }
+
lastObj := last.Value.(plumbing.EncodedObject)
lastSize := FileSize(lastObj.Size())