mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix crash when clicking on the screen with no game loaded
This commit is contained in:
parent
3c85f40a8f
commit
2fa3b3089a
|
@ -698,6 +698,9 @@ void Window::dropEvent(QDropEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::mouseMoveEvent(QMouseEvent* event) {
|
void Window::mouseMoveEvent(QMouseEvent* event) {
|
||||||
|
if (!m_controller->isLoaded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
QPoint pos = event->pos();
|
QPoint pos = event->pos();
|
||||||
pos = m_screenWidget->mapFrom(this, pos);
|
pos = m_screenWidget->mapFrom(this, pos);
|
||||||
QSize dimensions = m_controller->screenDimensions();
|
QSize dimensions = m_controller->screenDimensions();
|
||||||
|
@ -713,6 +716,9 @@ void Window::mousePressEvent(QMouseEvent* event) {
|
||||||
if (event->button() != Qt::LeftButton) {
|
if (event->button() != Qt::LeftButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!m_controller->isLoaded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mouseMoveEvent(event);
|
mouseMoveEvent(event);
|
||||||
m_controller->cursorDown(true);
|
m_controller->cursorDown(true);
|
||||||
}
|
}
|
||||||
|
@ -721,6 +727,9 @@ void Window::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
if (event->button() != Qt::LeftButton) {
|
if (event->button() != Qt::LeftButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!m_controller->isLoaded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mouseMoveEvent(event);
|
mouseMoveEvent(event);
|
||||||
m_controller->cursorDown(false);
|
m_controller->cursorDown(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue