Duration and samples throw error on WAVE file with no sub-chunks #13

Merged
merged 3 commits into from Mar 30, 2016

Conversation

2 participants
@joshaidan
Contributor

joshaidan commented Mar 30, 2016

I noticed when using WaveInfo on WAVE valid wave files with no data (or sub-chunks) that calling duration or samples would throw the following error:

     NoMethodError:
       undefined method `/' for nil:NilClass

I've created two tests to catch this error, and submitted a possible fix for the problem. Instead of throwing an error, my proposed changes will return zero instead. Also, I added a few checks to prevent divide by zero.

@njh njh merged commit 8362019 into njh:master Mar 30, 2016

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
@njh

This comment has been minimized.

Show comment
Hide comment
@njh

njh Mar 30, 2016

Owner

Looks great, thanks!

Owner

njh commented Mar 30, 2016

Looks great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment