diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -758,6 +758,9 @@ void MainWindow::updateSeletedDeviceMenu() { QMenu* devicesMenu = static_cast(guiFactory()->container(QStringLiteral("selectedDevice"), this)); + if (!devicesMenu) + return; + devicesMenu->clear(); devicesMenu->setEnabled(!operationStack().previewDevices().isEmpty()); @@ -778,7 +781,7 @@ QAction* action = qobject_cast(sender()); QMenu* devicesMenu = static_cast(guiFactory()->container(QStringLiteral("selectedDevice"), this)); - if (action == nullptr || action->parent() != devicesMenu) + if (action == nullptr || action->parent() != devicesMenu || !devicesMenu) return; const auto children = devicesMenu->findChildren(); @@ -791,6 +794,8 @@ void MainWindow::on_m_ListDevices_selectionChanged(const QString& device_node) { QMenu* devicesMenu = static_cast(guiFactory()->container(QStringLiteral("selectedDevice"), this)); + if (!devicesMenu) + return; const auto children = devicesMenu->findChildren(); for (auto &entry : children)