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
1 files changed,
9 insertions(+),
0 deletions(-)
jump to
M
src/platform/qt/Window.cpp
→
src/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);