Don't crash if no ROM is loaded

This commit is contained in:
Jeffrey Pfau 2014-07-17 02:55:13 -07:00
parent 74fcdf54e0
commit 2367abe67d
1 changed files with 5 additions and 1 deletions

View File

@ -201,7 +201,7 @@ bool GBAThreadStart(struct GBAThread* threadContext) {
threadContext->rewindBuffer = 0; threadContext->rewindBuffer = 0;
} }
if (!GBAIsROM(threadContext->rom)) { if (threadContext->rom && !GBAIsROM(threadContext->rom)) {
threadContext->rom->close(threadContext->rom); threadContext->rom->close(threadContext->rom);
threadContext->rom = 0; threadContext->rom = 0;
} }
@ -226,6 +226,10 @@ bool GBAThreadStart(struct GBAThread* threadContext) {
} }
} }
if (!threadContext->rom) {
return false;
}
if (threadContext->fname && !threadContext->save) { if (threadContext->fname && !threadContext->save) {
char* savedata = 0; char* savedata = 0;
char* dotPoint = strrchr(threadContext->fname, '.'); char* dotPoint = strrchr(threadContext->fname, '.');