[Scummvm-git-logs] scummvm master -> e2d91258b7bfb989dc099f516bb31ceb44554529
bluegr
bluegr at gmail.com
Mon Dec 2 09:05:01 UTC 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e2d91258b7 PLUGINS: Fix crash when no plugins are available
Commit: e2d91258b7bfb989dc099f516bb31ceb44554529
https://github.com/scummvm/scummvm/commit/e2d91258b7bfb989dc099f516bb31ceb44554529
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-12-02T11:04:57+02:00
Commit Message:
PLUGINS: Fix crash when no plugins are available
Changed paths:
backends/plugins/elf/elf-provider.cpp
base/plugins.cpp
diff --git a/backends/plugins/elf/elf-provider.cpp b/backends/plugins/elf/elf-provider.cpp
index 28536ee..6d461c7 100644
--- a/backends/plugins/elf/elf-provider.cpp
+++ b/backends/plugins/elf/elf-provider.cpp
@@ -181,15 +181,17 @@ PluginList ELFPluginProvider::getPlugins() {
PluginList pl = FilePluginProvider::getPlugins();
#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
- // This static downcast is safe because all of the plugins must
- // be ELF plugins
- for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
- (static_cast<ELFPlugin *>(*p))->trackSize();
- }
+ if (!pl.empty()) {
+ // This static downcast is safe because all of the plugins must
+ // be ELF plugins
+ for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) {
+ (static_cast<ELFPlugin *>(*p))->trackSize();
+ }
- // The Memory Manager should now allocate space based on the information
- // it collected
- ELFMemMan.allocateHeap();
+ // The Memory Manager should now allocate space based on the information
+ // it collected
+ ELFMemMan.allocateHeap();
+ }
#endif
return pl;
diff --git a/base/plugins.cpp b/base/plugins.cpp
index d573359..490ca33 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;
}
More information about the Scummvm-git-logs
mailing list