From 153cb623b892fbbe747ccace9bcc899f9233be65 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Fri, 3 Oct 2025 16:38:43 -0700 Subject: [PATCH] Fix #729: add bounds checking to LyricsViewer --- ui/widgets/lyricsviewer.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/widgets/lyricsviewer.go b/ui/widgets/lyricsviewer.go index ffce8dd..647617e 100644 --- a/ui/widgets/lyricsviewer.go +++ b/ui/widgets/lyricsviewer.go @@ -95,7 +95,8 @@ func (l *LyricsViewer) UpdatePlayPos(timeSecs float64) { } l.lastPlayPos = timeSecs // advance if needed - if l.lyrics.Lines[l.nextLyricLine].Start <= timeSecs { + if l.nextLyricLine >= 0 && l.nextLyricLine < len(l.lyrics.Lines) && + l.lyrics.Lines[l.nextLyricLine].Start <= timeSecs { l.viewer.NextLine() if l.nextLyricLine < len(l.lyrics.Lines)-1 { l.nextLyricLine++ @@ -125,7 +126,9 @@ func (l *LyricsViewer) OnSeeked(timeSecs float64) { } else { l.nextLyricLine = nextLine } - l.viewer.SetCurrentLine(nextLine /*one-indexed*/) + if nextLine >= 0 && nextLine <= len(l.lyrics.Lines) { + l.viewer.SetCurrentLine(nextLine /*one-indexed*/) + } } func (l *LyricsViewer) CreateRenderer() fyne.WidgetRenderer {