From 022508647fc51dca5a7bb35c3a746073530797dc Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 11 Jun 2019 16:35:38 +0000 Subject: [PATCH] Return a NopIterator when bigchunk is empty Signed-off-by: Bryan Boreham --- pkg/chunk/encoding/bigchunk.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/chunk/encoding/bigchunk.go b/pkg/chunk/encoding/bigchunk.go index 0282c08e997..b028d6e8ab0 100644 --- a/pkg/chunk/encoding/bigchunk.go +++ b/pkg/chunk/encoding/bigchunk.go @@ -170,9 +170,15 @@ func (b *bigchunk) Size() int { } func (b *bigchunk) NewIterator() Iterator { + var it chunkenc.Iterator + if len(b.chunks) > 0 { + it = b.chunks[0].Iterator() + } else { + it = chunkenc.NewNopIterator() + } return &bigchunkIterator{ bigchunk: b, - curr: b.chunks[0].Iterator(), + curr: it, } }