1
0

In Playlist.load() a check for an empty file was added.

This commit is contained in:
Alexander Andreev 2023-10-07 23:17:42 +04:00
parent 131ea35341
commit da4e97f1aa
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -50,10 +50,16 @@ func (p *Playlist) load() error {
if err != nil { if err != nil {
return errors.Wrap(err, "cannot open a playlist file") 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.Lock()
p.playlist = strings.Split(string(data), "\n") p.playlist = strings.Split(string(data), "\n")
p.cur = 0 p.cur = 0
p.Unlock() p.Unlock()
return nil return nil
} }