From a0ddd85b32d9f6a689b16be442c8c979c6381097 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 12 Jul 2023 15:53:46 +0200 Subject: [PATCH] Merge pull request #1333 from Ryex/fix/null_instance_edit_crash --- launcher/ui/MainWindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 515abf070..5a8fcc78f 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1279,7 +1279,17 @@ void MainWindow::globalSettingsClosed() void MainWindow::on_actionEditInstance_triggered() { - APPLICATION->showInstanceWindow(m_selectedInstance); + + if (!m_selectedInstance) + return; + + if (m_selectedInstance->canEdit()) { + APPLICATION->showInstanceWindow(m_selectedInstance); + } else { + CustomMessageBox::selectable(this, tr("Instance not editable"), + tr("This instance is not editable. It may be broken, invalid, or too old. Check logs for details."), + QMessageBox::Critical)->show(); + } } void MainWindow::on_actionManageAccounts_triggered()