views:

14

answers:

0

Hello,

As my program allows the user to import any .mp3 file into their library, there is a possibility that they might try to play an mp3 that is in someway corrupt. My audio player uses NSSound to play the file and currently when presented with a dodgy mp3 file it crashes with an EXC_ARITHMETIC exception. A brief look on this site told me that it's not an obj-c exception so I can't use try/catch and also led me to the uncaught exception handler. The problem with this is that it still kills the program, which is a bit harsh for trying to play a broken file.

What I'd like to do is be able to pick out corrupt mp3s and not try and play them, thus avoiding the crash entirely! Problem is that I'm not entirely sure what to look for, so any tips on this would be appreciated. Failing this, a method of recovering from the error would be great too.