Xeiron / sndfile.rs

A safe rust wrapper of libsndfile
MIT License
10 stars 7 forks source link

Fixed get_tag, added an Option wrapping to deal with missing tags #4

Closed maxmarsc closed 2 years ago

maxmarsc commented 2 years ago

Close #3

A fix proposal to fix issue #3, I added an Option wrapping to get_tag return.

Explanation : As mentioned in the the thread, libsndfile will return a NULL pointer if the asked tag does not exists, which cause a segfault. This fix deals with the NULL ptr by return a None

As I understand it is a little breaking change tell me if you'd rather return an empty string as mentioned in the issue thread, it could be done too, even though it might not be the most idiomatic.