From 7e52f6ce6e48d458f419a75015382cd4bdfe69b7 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Wed, 25 Jun 2014 17:39:40 -0400 Subject: [PATCH] Indexing into an empty fixed iterator for logging purposes no longer crashes. Fixes #3. --- src/graph/fixed-iterator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/graph/fixed-iterator.go b/src/graph/fixed-iterator.go index 3b82586..7578611 100644 --- a/src/graph/fixed-iterator.go +++ b/src/graph/fixed-iterator.go @@ -84,12 +84,17 @@ func (f *FixedIterator) AddValue(v TSVal) { // Print some information about the iterator. func (f *FixedIterator) DebugString(indent int) string { + value := "" + if len(f.values) > 0 { + value = fmt.Sprint(f.values[0]) + } return fmt.Sprintf("%s(%s tags: %s Size: %d id0: %d)", strings.Repeat(" ", indent), f.Type(), f.FixedTags(), len(f.values), - f.values[0]) + value, + ) } // Register this iterator as a Fixed iterator.