all repos — mgba @ 2367abe67dae4076ae178a03940daefc42441e49

mGBA Game Boy Advance Emulator

Don't crash if no ROM is loaded
Jeffrey Pfau jeffrey@endrift.com
Thu, 17 Jul 2014 02:55:13 -0700
commit

2367abe67dae4076ae178a03940daefc42441e49

parent

74fcdf54e048f118df070bc7fbfa3e70e5c95495

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M src/gba/gba-thread.csrc/gba/gba-thread.c

@@ -201,7 +201,7 @@ } else {

threadContext->rewindBuffer = 0; } - if (!GBAIsROM(threadContext->rom)) { + if (threadContext->rom && !GBAIsROM(threadContext->rom)) { threadContext->rom->close(threadContext->rom); threadContext->rom = 0; }

@@ -224,6 +224,10 @@ vf->close(vf);

} dirent = threadContext->gamedir->listNext(threadContext->gamedir); } + } + + if (!threadContext->rom) { + return false; } if (threadContext->fname && !threadContext->save) {