From 2367abe67dae4076ae178a03940daefc42441e49 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Thu, 17 Jul 2014 02:55:13 -0700 Subject: [PATCH] Don't crash if no ROM is loaded --- src/gba/gba-thread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gba/gba-thread.c b/src/gba/gba-thread.c index 8ec00c405..fe31aafc0 100644 --- a/src/gba/gba-thread.c +++ b/src/gba/gba-thread.c @@ -201,7 +201,7 @@ bool GBAThreadStart(struct GBAThread* threadContext) { threadContext->rewindBuffer = 0; } - if (!GBAIsROM(threadContext->rom)) { + if (threadContext->rom && !GBAIsROM(threadContext->rom)) { threadContext->rom->close(threadContext->rom); threadContext->rom = 0; } @@ -226,6 +226,10 @@ bool GBAThreadStart(struct GBAThread* threadContext) { } } + if (!threadContext->rom) { + return false; + } + if (threadContext->fname && !threadContext->save) { char* savedata = 0; char* dotPoint = strrchr(threadContext->fname, '.');