diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index ec87b29c6..b059bf561 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -759,7 +759,7 @@ void MainWindow::setWindowTitle() { void MainWindow::changeEvent(QEvent *event) { // Clear current key state upon any window activation change. - if(event->type() == QEvent::ActivationChange) { + if(machine && event->type() == QEvent::ActivationChange) { const auto keyboardMachine = machine->keyboard_machine(); if(keyboardMachine) { keyboardMachine->clear_all_keys();