GUI: Fix crash when enabling auto save

"engineid" isn't present on all games. Games that predate the "engineid"
feature and haven't been run since it was introduced don't have it yet.

Fixes bug #13038
This commit is contained in:
sluicebox 2021-11-11 15:29:40 -06:00
parent 61c4cbe1f4
commit 2ac5fd5c02

View file

@ -2545,7 +2545,9 @@ bool GlobalOptionsDialog::updateAutosavePeriod(int newValue) {
for (ConfigManager::DomainMap::const_iterator it = domains.begin(), end = domains.end(); it != end; ++it) {
const Common::String target = it->_key;
const ConfigManager::Domain domain = it->_value;
const Common::String engine = domain["engineid"];
// note that engineid isn't present on games that predate it
// and haven't been run since it was introduced.
const Common::String engine = domain.getValOrDefault("engineid");
if (const Plugin *detectionPlugin = EngineMan.findPlugin(engine)) {
if (const Plugin *plugin = PluginMan.getEngineFromMetaEngine(detectionPlugin)) {
MetaEngine &metaEngine = plugin->get<MetaEngine>();