Okay, there is actually a new line at the end of file. Let's skip that.
This commit is contained in:
parent
c58ef0685a
commit
c02442ebcd
@ -130,10 +130,12 @@ func icecastLastPlayedSongs(playlistPath string, n int) ([]Song, error) {
|
|||||||
|
|
||||||
lines := bytes.Split(buf, []byte("\n"))
|
lines := bytes.Split(buf, []byte("\n"))
|
||||||
|
|
||||||
if len(lines) < 1 {
|
if len(lines) < 2 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lines = lines[:len(lines)-1]
|
||||||
|
|
||||||
if len(lines) > n {
|
if len(lines) > n {
|
||||||
lines = lines[len(lines)-n:]
|
lines = lines[len(lines)-n:]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user