Gracefully handle the case when a zip file contains no known Model 3 ROM set.

This commit is contained in:
Bart Trzynadlowski 2015-06-13 02:57:41 +00:00
parent 6bf4244207
commit 1035b0c6a8

View file

@ -264,6 +264,13 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
}
}
if (Game == NULL)
{
ErrorLog("No Model 3 games found in '%s'.", zipFile);
unzClose(zf);
return NULL;
}
if (CurGame->parent)
{
// Create parent zip file name
@ -288,6 +295,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
if (NULL == zfp)
{
ErrorLog("Parent ROM set '%s' is missing.", zipFileParent.c_str());
unzClose(zf);
return NULL;
}
}
@ -297,6 +305,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
if (UNZ_OK != err)
{
ErrorLog("Unable to read the contents of '%s' (code %X)", zipFile, err);
unzClose(zf);
return NULL;
}
memset(romsFound, 0, sizeof(romsFound)); // here, romsFound[] indicates which ROMs were found in the ZIP file for the game
@ -320,6 +329,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
if (UNZ_OK != err)
{
ErrorLog("Unable to read the contents of '%s' (code %X)", zipFileParent.c_str(), err);
unzClose(zf);
return NULL;
}
for (; err != UNZ_END_OF_LIST_OF_FILE; err = unzGoToNextFile(zfp))