summaryrefslogtreecommitdiff
path: root/src/plugincontainer.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-12-04 13:33:14 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2020-12-04 13:33:14 +0100
commit7a3bc0cd23e637d66a1f78809f7229e665391cdb (patch)
tree60966e16f9d13364778ec3719b69a0b9c616e66f /src/plugincontainer.cpp
parent4118aef2a28964d1bffdb489bf2223fbd6f994db (diff)
Throw exception when trying to unload the current game plugin.
Diffstat (limited to 'src/plugincontainer.cpp')
-rw-r--r--src/plugincontainer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp
index a2f0d5f0..c3d66913 100644
--- a/src/plugincontainer.cpp
+++ b/src/plugincontainer.cpp
@@ -850,6 +850,11 @@ void PluginContainer::loadPlugin(QString const& filepath)
void PluginContainer::unloadPlugin(MOBase::IPlugin* plugin, QObject* object)
{
if (auto* game = qobject_cast<IPluginGame*>(object)) {
+
+ if (game == managedGame()) {
+ throw Exception("cannot unload the plugin for the currently managed game");
+ }
+
unregisterGame(game);
}