From 43f20f511c2a310af39d06e80a70cbee5684ec4b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 3 Dec 2020 20:03:35 -0500 Subject: handle null plugin when adding a download happens when some plugins refer to other plugins that are missing --- src/downloadmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/downloadmanager.cpp') 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 -- cgit v1.3.1