Skip to content

Commit c44ee31

Browse files
Prevent crash when opening NXM link before selecting instance (ModOrganizer2#2144)
1 parent 08fc25d commit c44ee31

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/moapplication.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,14 @@ void MOApplication::externalMessage(const QString& message)
390390
}
391391
}
392392
} else if (isNxmLink(message)) {
393-
MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false);
394-
m_core->downloadRequestedNXM(message);
393+
if (InstanceManager::singleton().currentInstance()->gamePlugin() == nullptr) {
394+
// This can happen if MO2 is started with the --pick option and no instance has
395+
// been selected yet, in which case m_core will be null.
396+
reportError(tr("You need to select an instance before trying to download mods."));
397+
} else {
398+
MessageDialog::showMessage(tr("Download started"), qApp->activeWindow(), false);
399+
m_core->downloadRequestedNXM(message);
400+
}
395401
} else {
396402
cl::CommandLine cl;
397403

0 commit comments

Comments
 (0)