Skip to content

Commit

Permalink
Prevent crash when opening NXM link before selecting instance
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanFeenstra committed Oct 14, 2024
1 parent 08fc25d commit 4dfafe1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/moapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("No instance has been selected. Cannot download mod."));
} else {
MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false);
m_core->downloadRequestedNXM(message);
}
} else {
cl::CommandLine cl;

Expand Down

0 comments on commit 4dfafe1

Please sign in to comment.