mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
PLUGINS: Fix crash when no plugins are available
This commit is contained in:
parent
a0c15492b4
commit
e2d91258b7
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user