Indexing into an empty fixed iterator for logging purposes no longer crashes. Fixes #3.

This commit is contained in:
Barak Michener 2014-06-25 17:39:40 -04:00
parent 3dae7c1d51
commit 7e52f6ce6e

View file

@ -84,12 +84,17 @@ func (f *FixedIterator) AddValue(v TSVal) {
// Print some information about the iterator. // Print some information about the iterator.
func (f *FixedIterator) DebugString(indent int) string { 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)", return fmt.Sprintf("%s(%s tags: %s Size: %d id0: %d)",
strings.Repeat(" ", indent), strings.Repeat(" ", indent),
f.Type(), f.Type(),
f.FixedTags(), f.FixedTags(),
len(f.values), len(f.values),
f.values[0]) value,
)
} }
// Register this iterator as a Fixed iterator. // Register this iterator as a Fixed iterator.