Added error checking to SID tune loading

CQTexperiment
Chris Moeller 2015-04-13 00:42:48 -07:00
parent a6b6369a6d
commit 18dac8e493
3 changed files with 11 additions and 1 deletions

View File

@ -53,6 +53,9 @@
SidTune * tune = new SidTune( (const uint_least8_t*)data, size );
if (!tune->getStatus())
return 0;
const SidTuneInfo * info = tune->getInfo();
unsigned int subsongs = info->songs();

View File

@ -31,6 +31,9 @@
tune = new SidTune((const uint_least8_t *)data, (uint_least32_t)size);
if (!tune->getStatus())
return NO;
NSURL * url = [s url];
int track_num;
if ([[url fragment] length] == 0)
@ -50,7 +53,7 @@
engine->setRoms( kernel, basic, chargen );
if ( engine->load( tune ) < 0 )
if ( !engine->load( tune ) )
return NO;
ReSIDfpBuilder * _builder = new ReSIDfpBuilder("ReSIDfp");

View File

@ -47,6 +47,10 @@
[source read:data amount:size];
SidTune * tune = new SidTune( (const uint_least8_t *)data, (uint_least32_t)size );
if (!tune->getStatus())
return 0;
const SidTuneInfo * info = tune->getInfo();
unsigned int count = info->numberOfInfoStrings();