summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-12-03 20:03:35 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-12-03 20:03:35 -0500
commit43f20f511c2a310af39d06e80a70cbee5684ec4b (patch)
tree30343ba2f5a807046664cf9611ff402bb9ee4b74
parent258a9e0f5a0df5973df6e660d24ba6f19fb963f1 (diff)
handle null plugin when adding a download
happens when some plugins refer to other plugins that are missing
-rw-r--r--src/downloadmanager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 648cfaa2..6817e7e7 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -550,6 +550,16 @@ void DownloadManager::addNXMDownload(const QString &url)
validGames.append(m_ManagedGame->validShortNames());
for (auto game : validGames) {
MOBase::IPluginGame* gamePlugin = m_OrganizerCore->getGame(game);
+
+ // some game plugins give names in validShortNames() that may refer to other
+ // plugins, like ttw returning "FalloutNV" and "Fallout3"; if these plugins
+ // are not loaded, getGame() might return null
+ if (!gamePlugin) {
+ // log an error, it's most probably not normal
+ log::error("no plugin for game '{}', an antivirus might have deleted it", game);
+ continue;
+ }
+
if (
nxmInfo.game().compare(gamePlugin->gameShortName(), Qt::CaseInsensitive) == 0 ||
nxmInfo.game().compare(gamePlugin->gameNexusName(), Qt::CaseInsensitive) == 0