From 2fa3b3089ac50b86b4e03f62dd7fe2eb82893847 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 6 Apr 2017 11:49:58 -0700 Subject: [PATCH] Qt: Fix crash when clicking on the screen with no game loaded --- src/platform/qt/Window.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 8a698d591..d009ebee6 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -698,6 +698,9 @@ void Window::dropEvent(QDropEvent* event) { } 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,6 +716,9 @@ void Window::mousePressEvent(QMouseEvent* event) { if (event->button() != Qt::LeftButton) { return; } + if (!m_controller->isLoaded()) { + return; + } mouseMoveEvent(event); m_controller->cursorDown(true); } @@ -721,6 +727,9 @@ void Window::mouseReleaseEvent(QMouseEvent* event) { if (event->button() != Qt::LeftButton) { return; } + if (!m_controller->isLoaded()) { + return; + } mouseMoveEvent(event); m_controller->cursorDown(false); }