Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Panic when ranging over segments #97

Open
kaihendry opened this issue Oct 25, 2017 · 2 comments
Open

Panic when ranging over segments #97

kaihendry opened this issue Oct 25, 2017 · 2 comments

Comments

@kaihendry
Copy link

https://play.golang.org/p/hmbq78PZbO

Why is the slice not the same size as the parsed segments of the playlist? How can I tell when I am about to go over the last segment and cause a panic?

Many thanks!

@kaihendry
Copy link
Author

Ok, discovered I can check for against nil, but why make it so odd to use?

@bradleyfalzon
Copy link
Collaborator

It's probably more of a legacy issue than anything else, we do auto extend now, but just by doubling of size.

To get the count of elements use https://godoc.org/github.com/grafov/m3u8#MediaPlaylist.Count

To loop them I normally check for nil and then break.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants