PLUGINS: Fix crash when no plugins are available
This commit is contained in:
parent
a0c15492b4
commit
e2d91258b7
2 changed files with 22 additions and 17 deletions
|
@ -181,6 +181,7 @@ PluginList ELFPluginProvider::getPlugins() {
|
|||
PluginList pl = FilePluginProvider::getPlugins();
|
||||
|
||||
#if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER)
|
||||
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) {
|
||||
|
@ -190,6 +191,7 @@ PluginList ELFPluginProvider::getPlugins() {
|
|||
// The Memory Manager should now allocate space based on the information
|
||||
// it collected
|
||||
ELFMemMan.allocateHeap();
|
||||
}
|
||||
#endif
|
||||
|
||||
return pl;
|
||||
|
|
|
@ -641,6 +641,8 @@ const Plugin *EngineManager::findPlugin(const Common::String &engineId) const {
|
|||
}
|
||||
|
||||
// We failed to find it using the engine ID. Scan the list of plugins
|
||||
const PluginList &plugins = getPlugins();
|
||||
if (!plugins.empty()) {
|
||||
PluginMan.loadFirstPlugin();
|
||||
do {
|
||||
plugin = findLoadedPlugin(engineId);
|
||||
|
@ -650,6 +652,7 @@ const Plugin *EngineManager::findPlugin(const Common::String &engineId) const {
|
|||
return plugin;
|
||||
}
|
||||
} while (PluginMan.loadNextPlugin());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue