From cd2b7683b78503d4fef1946de088108b812b387c Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Fri, 1 May 2020 17:31:37 +0200 Subject: Avoid using GamePlugins when not provided by the game plugin. --- src/directoryrefresher.cpp | 13 +++++++++---- src/pluginlist.cpp | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index 0369b1b0..383e6b33 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -216,9 +216,12 @@ void DirectoryRefresher::addModBSAToStructure( { const IPluginGame *game = qApp->property("managed_game").value(); - GamePlugins *gamePlugins = game->feature(); QStringList loadOrder = QStringList(); - gamePlugins->getLoadOrder(loadOrder); + + GamePlugins* gamePlugins = game->feature(); + if (gamePlugins) { + gamePlugins->getLoadOrder(loadOrder); + } std::vector lo; for (auto&& s : loadOrder) { @@ -364,9 +367,11 @@ struct ModThread if (Settings::instance().archiveParsing()) { const IPluginGame *game = qApp->property("managed_game").value(); - GamePlugins *gamePlugins = game->feature(); QStringList loadOrder = QStringList(); - gamePlugins->getLoadOrder(loadOrder); + GamePlugins* gamePlugins = game->feature(); + if (gamePlugins) { + gamePlugins->getLoadOrder(loadOrder); + } std::vector lo; for (auto&& s : loadOrder) { diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 1f320982..c2667557 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -185,7 +185,8 @@ void PluginList::refresh(const QString &profileName ChangeBracket layoutChange(this); QStringList primaryPlugins = m_GamePlugin->primaryPlugins(); - bool lightPluginsAreSupported = m_GamePlugin->feature()->lightPluginsAreSupported(); + GamePlugins *gamePlugins = m_GamePlugin->feature(); + const bool lightPluginsAreSupported = gamePlugins ? gamePlugins->lightPluginsAreSupported() : false; m_CurrentProfile = profileName; @@ -265,8 +266,9 @@ void PluginList::refresh(const QString &profileName // indices need to work. priority will be off however updateIndices(); - GamePlugins *gamePlugins = m_GamePlugin->feature(); - gamePlugins->readPluginLists(this); + if (gamePlugins) { + gamePlugins->readPluginLists(this); + } testMasters(); @@ -521,7 +523,9 @@ void PluginList::saveTo(const QString &lockedOrderFileName , bool hideUnchecked) const { GamePlugins *gamePlugins = m_GamePlugin->feature(); - gamePlugins->writePluginLists(this); + if (gamePlugins) { + gamePlugins->writePluginLists(this); + } writeLockedOrder(lockedOrderFileName); @@ -870,7 +874,10 @@ void PluginList::generatePluginIndexes() { int numESLs = 0; int numSkipped = 0; - bool lightPluginsSupported = m_GamePlugin->feature()->lightPluginsAreSupported(); + + GamePlugins* gamePlugins = m_GamePlugin->feature(); + const bool lightPluginsSupported = gamePlugins ? gamePlugins->lightPluginsAreSupported() : false; + for (int l = 0; l < m_ESPs.size(); ++l) { int i = m_ESPsByPriority.at(l); if (!m_ESPs[i].enabled) { -- cgit v1.3.1