From 96d030ff0a5b9aa4bc1ba4fa26be88f4fbaf8800 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Tue, 3 Oct 2023 16:33:30 +1000 Subject: [PATCH] Fix(cannon): Fix nil next panic --- pkg/cannon/iterator/checkpoint_iterator.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cannon/iterator/checkpoint_iterator.go b/pkg/cannon/iterator/checkpoint_iterator.go index fe4617d2..7dab9b09 100644 --- a/pkg/cannon/iterator/checkpoint_iterator.go +++ b/pkg/cannon/iterator/checkpoint_iterator.go @@ -60,11 +60,11 @@ func (c *CheckpointIterator) Next(ctx context.Context) (next *xatu.CannonLocatio defer func() { if err != nil { span.RecordError(err) - } - - epoch, err := c.getEpochFromLocation(next) - if err == nil { - span.SetAttributes(attribute.Int64("next", int64(epoch))) + } else { + epoch, err := c.getEpochFromLocation(next) + if err == nil { + span.SetAttributes(attribute.Int64("next", int64(epoch))) + } } span.End()