all repos — mgba @ 2fa3b3089ac50b86b4e03f62dd7fe2eb82893847

mGBA Game Boy Advance Emulator

Qt: Fix crash when clicking on the screen with no game loaded
Vicki Pfau vi@endrift.com
Thu, 06 Apr 2017 11:49:58 -0700
commit

2fa3b3089ac50b86b4e03f62dd7fe2eb82893847

parent

3c85f40a8f52f0780ecd7339697e60111f53ec1b

1 files changed, 9 insertions(+), 0 deletions(-)

jump to
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -698,6 +698,9 @@ m_controller->loadGame(url.toLocalFile());

} void Window::mouseMoveEvent(QMouseEvent* event) { + if (!m_controller->isLoaded()) { + return; + } QPoint pos = event->pos(); pos = m_screenWidget->mapFrom(this, pos); QSize dimensions = m_controller->screenDimensions();

@@ -713,12 +716,18 @@ void Window::mousePressEvent(QMouseEvent* event) {

if (event->button() != Qt::LeftButton) { return; } + if (!m_controller->isLoaded()) { + return; + } mouseMoveEvent(event); m_controller->cursorDown(true); } void Window::mouseReleaseEvent(QMouseEvent* event) { if (event->button() != Qt::LeftButton) { + return; + } + if (!m_controller->isLoaded()) { return; } mouseMoveEvent(event);