diff options
| author | Jonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com> | 2024-10-15 11:02:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-15 11:02:56 +0200 |
| commit | c44ee31e9f50d68cb687d3683ffc91738a819430 (patch) | |
| tree | 80b0777d030ee03a21b750afac7681738128efec | |
| parent | 08fc25d641e7f426ffc5b90e7ed7bd8acd132a8b (diff) | |
Prevent crash when opening NXM link before selecting instance (#2144)
| -rw-r--r-- | src/moapplication.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/moapplication.cpp b/src/moapplication.cpp index bf6a4074..f06a85d1 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -390,8 +390,14 @@ void MOApplication::externalMessage(const QString& message) } } } else if (isNxmLink(message)) { - MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false); - m_core->downloadRequestedNXM(message); + if (InstanceManager::singleton().currentInstance()->gamePlugin() == nullptr) { + // This can happen if MO2 is started with the --pick option and no instance has + // been selected yet, in which case m_core will be null. + reportError(tr("You need to select an instance before trying to download mods.")); + } else { + MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false); + m_core->downloadRequestedNXM(message); + } } else { cl::CommandLine cl; |
