aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorCameron Cawley2019-12-01 21:26:42 +0000
committerFilippos Karapetis2019-12-02 11:04:57 +0200
commite2d91258b7bfb989dc099f516bb31ceb44554529 (patch)
tree2bc300f76be4d4c8294789ea78beba12da5af21f /base
parenta0c15492b41216d51903b20b2c4f2784fee7b08e (diff)
downloadscummvm-rg350-e2d91258b7bfb989dc099f516bb31ceb44554529.tar.gz
scummvm-rg350-e2d91258b7bfb989dc099f516bb31ceb44554529.tar.bz2
scummvm-rg350-e2d91258b7bfb989dc099f516bb31ceb44554529.zip
PLUGINS: Fix crash when no plugins are available
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;
}