From da4e97f1aadec274951c72dad83174006b21e0d1 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 7 Oct 2023 23:17:42 +0400 Subject: [PATCH] In Playlist.load() a check for an empty file was added. --- internal/radio/playlist.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/radio/playlist.go b/internal/radio/playlist.go index fa25aba..52a0ebe 100644 --- a/internal/radio/playlist.go +++ b/internal/radio/playlist.go @@ -50,10 +50,16 @@ func (p *Playlist) load() error { if err != nil { return errors.Wrap(err, "cannot open a playlist file") } + + if len(data) == 0 { + return errors.New("a playlist file is empty. Did not update") + } + p.Lock() p.playlist = strings.Split(string(data), "\n") p.cur = 0 p.Unlock() + return nil }