grafov / m3u8

Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. :cinema:
http://tools.ietf.org/html/draft-pantos-http-live-streaming
BSD 3-Clause "New" or "Revised" License
1.22k stars 312 forks source link

fix media segments panic #186

Closed misssonder closed 1 year ago

grafov commented 1 year ago

After the patch I've got:

GO111MODULE=on go run ./
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/grafov/m3u8.(*MediaPlaylist).AppendSegment(0xc0000181b9?, 0x5?)
    /home/a/prj/github.com/grafov/m3u8/writer.go:372 +0x17c
github.com/grafov/m3u8.(*MediaPlaylist).Append(...)
    /home/a/prj/github.com/grafov/m3u8/writer.go:359
github.com/grafov/m3u8.decodeLineOfMediaPlaylist(0xc000124000, 0xc000122000, 0xc000067dd8, {0xc0000181b9?, 0x424f01?}, 0x1)
    /home/a/prj/github.com/grafov/m3u8/reader.go:496 +0x20fc
github.com/grafov/m3u8.decode(0xc000067eb0?, 0x1, {0x0, 0x0, 0x0})
    /home/a/prj/github.com/grafov/m3u8/reader.go:227 +0x33d
github.com/grafov/m3u8.DecodeFrom({0x510138?, 0xc00007e240?}, 0x7?)
    /home/a/prj/github.com/grafov/m3u8/reader.go:161 +0x7b
main.main()
    /home/a/go/src/playground/at-2023-02-23-165448/snippet.go:40 +0xaa
exit status 2

Need more investigaation.