1
0

Removed handling of imposible cases.

This commit is contained in:
Alexander Andreev 2022-08-29 09:19:35 +04:00
parent 1996743470
commit d43b2fe897
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -137,9 +137,7 @@ func lastPlayedSong(playlistPath string) (*Song, error) {
newline_end_pos := bytes.LastIndexByte(buf, '\n') newline_end_pos := bytes.LastIndexByte(buf, '\n')
if newline_end_pos == -1 && !bytes.ContainsRune(buf, '|') { if newline_end_pos == -1 {
return nil, nil
} else if newline_end_pos == -1 {
newline_end_pos = len(buf) newline_end_pos = len(buf)
} }
@ -147,10 +145,6 @@ func lastPlayedSong(playlistPath string) (*Song, error) {
last_song_line = string(buf[newline_start_pos+1 : newline_end_pos-1]) last_song_line = string(buf[newline_start_pos+1 : newline_end_pos-1])
if strings.Count(last_song_line, "|") != 3 {
return nil, nil
}
fields := strings.Split(last_song_line, "|") fields := strings.Split(last_song_line, "|")
tim, _ := time.Parse(IcecastPlaylistDateFormat, fields[0]) tim, _ := time.Parse(IcecastPlaylistDateFormat, fields[0])