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) {
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue