aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/plugins.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index d5733599be..490ca33821 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -641,15 +641,18 @@ const Plugin *EngineManager::findPlugin(const Common::String &engineId) const {
}
// We failed to find it using the engine ID. Scan the list of plugins
- PluginMan.loadFirstPlugin();
- do {
- plugin = findLoadedPlugin(engineId);
- if (plugin) {
- // Update with new plugin file name
- PluginMan.updateConfigWithFileName(engineId);
- return plugin;
- }
- } while (PluginMan.loadNextPlugin());
+ const PluginList &plugins = getPlugins();
+ if (!plugins.empty()) {
+ PluginMan.loadFirstPlugin();
+ do {
+ plugin = findLoadedPlugin(engineId);
+ if (plugin) {
+ // Update with new plugin file name
+ PluginMan.updateConfigWithFileName(engineId);
+ return plugin;
+ }
+ } while (PluginMan.loadNextPlugin());
+ }
return 0;
}