From 03c4424f1d8d37e7985b4bb57824229c054f9f5c Mon Sep 17 00:00:00 2001 From: raziman Date: Tue, 23 Feb 2021 21:34:33 +0800 Subject: [PATCH] fix panic when audio file does not have subtitle --- playingbar.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/playingbar.go b/playingbar.go index 82f2922..834760e 100644 --- a/playingbar.go +++ b/playingbar.go @@ -211,6 +211,11 @@ func (p *PlayingBar) stop() { } func (p *PlayingBar) switchLyrics() { + + if len(p.subtitles) == 0 { + return + } + var langIndex int for i := range p.subtitles { if p.subtitles[i].langExt == p.langLyric {