[Scummvm-git-logs] scummvm master -> f88769f132d185ffc7cf5f2972036f4182045288

bluegr bluegr at gmail.com
Thu Apr 8 09:18:14 UTC 2021


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:
f88769f132 BASE: Fix a crash when attempting to run a disabled engine


Commit: f88769f132d185ffc7cf5f2972036f4182045288
    https://github.com/scummvm/scummvm/commit/f88769f132d185ffc7cf5f2972036f4182045288
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-04-08T12:18:11+03:00

Commit Message:
BASE: Fix a crash when attempting to run a disabled engine

Changed paths:
    base/main.cpp


diff --git a/base/main.cpp b/base/main.cpp
index cadf4d50be..5ee1968fad 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -154,6 +154,7 @@ void saveLastLaunchedTarget(const Common::String &target) {
 // TODO: specify the possible return values here
 static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, OSystem &system, const Common::String &edebuglevels) {
 	assert(plugin);
+	assert(enginePlugin);
 
 	// Determine the game data path, for validation and error messages
 	Common::FSNode dir(ConfMan.get("path"));
@@ -547,14 +548,17 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 
 		// Try to find a MetaEnginePlugin which feels responsible for the specified game.
 		const Plugin *plugin = detectPlugin();
-		if (plugin) {
-			// Unload all plugins not needed for this game, to save memory
 
+		// Then, get the relevant Engine plugin from MetaEngine.
+		const Plugin *enginePlugin = nullptr;
+		if (plugin)
+			enginePlugin = PluginMan.getEngineFromMetaEngine(plugin);
+
+		if (enginePlugin) {
+			// Unload all plugins not needed for this game, to save memory
 			// Right now, we have a MetaEngine plugin, and we want to unload all except Engine.
-			// First, get the relevant Engine plugin from MetaEngine.
-			const Plugin *enginePlugin = PluginMan.getEngineFromMetaEngine(plugin);
 
-			// Then, pass in the pointer to enginePlugin, with the matching type, so our function behaves as-is.
+			// Pass in the pointer to enginePlugin, with the matching type, so our function behaves as-is.
 			PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, enginePlugin);
 
 #if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) && !defined(DETECTION_STATIC)




More information about the Scummvm-git-logs mailing list