Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants