From 123dc183987e1fac9654b0d877b46cbc43bfe535 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 21 Feb 2016 12:57:31 -0800 Subject: [PATCH] Qt: Fix crash on invalid ROM loads --- src/platform/qt/GameController.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index f5ce3712d..048501eec 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -306,6 +306,16 @@ void GameController::openGame(bool biosOnly) { return; } + if (!biosOnly) { + m_threadContext.core = mCoreFind(m_fname.toUtf8().constData()); + } else { + m_threadContext.core = GBACoreCreate(); + } + + if (!m_threadContext.core) { + return; + } + m_gameOpen = true; m_pauseAfterFrame = false; @@ -317,13 +327,6 @@ void GameController::openGame(bool biosOnly) { m_threadContext.sync.videoFrameWait = m_videoSync; m_threadContext.sync.audioWait = m_audioSync; } - - - if (!biosOnly) { - m_threadContext.core = mCoreFind(m_fname.toUtf8().constData()); - } else { - m_threadContext.core = GBACoreCreate(); - } m_threadContext.core->init(m_threadContext.core); unsigned width, height;