43081j / id3

A JavaScript ID3 tags parser for Node & browsers.
MIT License
335 stars 63 forks source link

Wrapped getUnit8() in a try...catch #11

Open wyqydsyq opened 10 years ago

wyqydsyq commented 10 years ago

Wrapping this if clause in a try...catch seems to alleviate the issue found in https://github.com/43081j/id3/issues/10 and possibly https://github.com/43081j/id3/issues/9

There seems to be no real negative impact in simply ignoring any exceptions generated by the tried code, the resulting tags seems to be completely fine, though a more graceful method of handling the exception should probably be implemented.

ntuckerxx commented 10 years ago

I've had the best results by wrapping the entire call to ID3Frame.parse in an exception handler, as there seem to be a handful of assumptions in there that don't hold for all files I've encountered. You can ignore frames that fail to parse and still process the rest of the file.

osmihi commented 9 years ago

I came here to propose the exact same change. Catching the exception here avoids unnecessarily failing the whole process due to one small problem in the tag. I agree that there may ultimately be a better place or additional places to put such a change, though.