fix potential but unlikely bug in advanscene import

This commit is contained in:
zeromus 2013-12-09 01:31:50 +00:00
parent 6caeb38edc
commit fcccf48307
1 changed files with 4 additions and 8 deletions

View File

@ -205,33 +205,29 @@ u32 ADVANsCEne::convertDB(const char *in_filename, EMUFILE* output)
// Save type
el_saveType = el->FirstChildElement("saveType");
u8 selectedSaveType = 0xFF; //unknown
if (el_saveType)
{
const char *tmp = el_saveType->GetText();
if (tmp)
{
if (strcmp(tmp, "None") == 0)
output->fputc(0xFE);
selectedSaveType = 0xFE;
else
{
bool bUnknown = true;
for (u8 i = 0; i < MAX_SAVE_TYPES; i++)
{
if (strcmp(saveTypeNames[i], "") == 0) continue;
if (strcasecmp(tmp, saveTypeNames[i]) == 0)
{
output->fputc(i);
bUnknown = false;
selectedSaveType = i;
break;
}
}
if (bUnknown)
output->fputc(0xFF); // Unknown
}
}
else
output->fputc(0xFF); // Unknown
}
output->fputc(selectedSaveType);
output->fwrite(&reserved, sizeof(u32));
output->fwrite(&reserved, sizeof(u32));
count++;