diff --git a/docs/release-notes/change-log.md b/docs/release-notes/change-log.md index cf11f6f8..4d59eceb 100644 --- a/docs/release-notes/change-log.md +++ b/docs/release-notes/change-log.md @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v1.10.6 + +* Fixed `substreams gui` panic (regression appeared in v1.10.3) + ## v1.10.5 * Fixed an(other) issue where multiple stores running on the same stage with different initialBlocks will fail to proress (and hang) diff --git a/tui2/components/blockselect/blockselect.go b/tui2/components/blockselect/blockselect.go index 2045e148..a4a547d5 100644 --- a/tui2/components/blockselect/blockselect.go +++ b/tui2/components/blockselect/blockselect.go @@ -117,7 +117,10 @@ func (b *BlockSelect) View() string { } var activeBlock string - ptr := int(float64(b.activeBlock-b.lowBlock) / binSize) + var ptr int + if b.activeBlock > 0 { // avoid division by zero + ptr = int(float64(b.activeBlock-b.lowBlock) / binSize) + } activeBlock = fmt.Sprintf("%s: %s", styles.BlockSelect.CurrentBlock.Render("Current block"), styles.BlockSelect.SelectedBlock.Render(humanize.Comma(int64(b.activeBlock))), @@ -134,6 +137,7 @@ func (b *BlockSelect) View() string { if repeatLen < 0 { repeatLen = 0 } + activeBlock = fmt.Sprintf("%s%s ^", strings.Repeat(" ", repeatLen), activeBlock,