fix crash in gbagame slot2 addon when gba rom doesn't exist

This commit is contained in:
zeromus 2016-03-30 23:50:54 +00:00
parent bf911bf571
commit aba30866b1
1 changed files with 2 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2009 CrazyMax Copyright (C) 2009 CrazyMax
Copyright (C) 2009-2015 DeSmuME team Copyright (C) 2009-2016 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -359,15 +359,14 @@ public:
printf("GBASlot opening ROM: %s\n", GBACartridge_RomPath.c_str()); printf("GBASlot opening ROM: %s\n", GBACartridge_RomPath.c_str());
EMUFILE_FILE *inf = new EMUFILE_FILE(GBACartridge_RomPath, "rb"); EMUFILE_FILE *inf = new EMUFILE_FILE(GBACartridge_RomPath, "rb");
inf->EnablePositionCache();
fROM = inf; fROM = inf;
if (fROM->fail()) if (fROM->fail())
{ {
printf(" - Failed\n"); printf(" - Failed\n");
Close(); Close();
return; return;
} }
inf->EnablePositionCache();
romSize = fROM->size(); romSize = fROM->size();
printf(" - Success (%u bytes)\n", romSize); printf(" - Success (%u bytes)\n", romSize);