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

Don't crash upon reaching EndFile, or if observing properties. #6

Merged
merged 1 commit into from
Apr 25, 2019

Conversation

yaymukund
Copy link
Contributor

If you reach the end of the file-- e.g. by playing past the end-- the following assertion fails triggers a panic:

https://github.com/ParadoxSpiral/mpv-rs/blob/99853ac04dd8cb890cce0b98a1094c2b873600e0/src/wrapper/events/simple.rs#L198

I changed it to return None.

Then it panics if it tries to observe a property change on an already-ended file because then the format is blank and the data is invalid. See:

https://github.com/ParadoxSpiral/mpv-rs/blob/99853ac04dd8cb890cce0b98a1094c2b873600e0/src/wrapper/events/simple.rs#L41
https://github.com/ParadoxSpiral/mpv-rs/blob/99853ac04dd8cb890cce0b98a1094c2b873600e0/mpv-sys/include/client.h#L1117-L1122

I patched that too, and now it no longer crashes when reaching the end of a file.

@ParadoxSpiral ParadoxSpiral merged commit 73ae0ed into ParadoxSpiral:master Apr 25, 2019
@ParadoxSpiral
Copy link
Owner

Thanks!

@yaymukund yaymukund deleted the handle-end-file branch April 26, 2019 11:44
@yaymukund
Copy link
Contributor Author

Thank you for merging this. It's all working smoothly for me :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants