[Scummvm-git-logs] scummvm branch-2-9 -> 6a546c614a03ce4a4d4475413adf771bbbe10cea

sev- noreply at scummvm.org
Thu Nov 28 23:13:31 UTC 2024


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:
6a546c614a GLK: Fix crash on a non-existent target startup


Commit: 6a546c614a03ce4a4d4475413adf771bbbe10cea
    https://github.com/scummvm/scummvm/commit/6a546c614a03ce4a4d4475413adf771bbbe10cea
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-29T00:13:25+01:00

Commit Message:
GLK: Fix crash on a non-existent target startup

Changed paths:
    engines/glk/adrift/detection.cpp
    engines/glk/detection.cpp
    engines/glk/hugo/detection.cpp
    engines/glk/level9/detection.cpp
    engines/glk/magnetic/detection.cpp


diff --git a/engines/glk/adrift/detection.cpp b/engines/glk/adrift/detection.cpp
index 1eb0ee3fcf4..dfbd015f7e7 100644
--- a/engines/glk/adrift/detection.cpp
+++ b/engines/glk/adrift/detection.cpp
@@ -80,7 +80,7 @@ GameDescriptor AdriftMetaEngine::findGame(const char *gameId) {
 		}
 	}
 
-	return PlainGameDescriptor();
+	return PlainGameDescriptor::empty();
 }
 
 bool AdriftMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index c559b7d5b58..a5445fecf65 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -173,7 +173,7 @@ PlainGameDescriptor GlkMetaEngineDetection::findGame(const char *gameId) const {
 	FIND_GAME(TADS);
 #endif
 
-	return PlainGameDescriptor();
+	return PlainGameDescriptor::empty();
 }
 
 #undef FIND_GAME
@@ -242,8 +242,13 @@ Common::Error GlkMetaEngineDetection::identifyGame(DetectedGame &game, const voi
 
 	*descriptor = gameDesc;
 
-	game = DetectedGame(getName(), findGame(ConfMan.get("gameid").c_str()));
-	return game.gameId.empty() ? Common::kUnknownError : Common::kNoError;
+	PlainGameDescriptor pdesc(findGame(ConfMan.get("gameid").c_str()));
+
+	if (!pdesc.gameId || !*pdesc.gameId)
+		return Common::kUnknownError;
+
+	game = DetectedGame(getName(), pdesc);
+	return Common::kNoError;
 }
 
 DetectedGames GlkMetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) {
diff --git a/engines/glk/hugo/detection.cpp b/engines/glk/hugo/detection.cpp
index be48edb5f91..3b8a48d4f84 100644
--- a/engines/glk/hugo/detection.cpp
+++ b/engines/glk/hugo/detection.cpp
@@ -41,7 +41,7 @@ GameDescriptor HugoMetaEngine::findGame(const char *gameId) {
 			return *pd;
 	}
 
-	return PlainGameDescriptor();
+	return PlainGameDescriptor::empty();
 }
 
 bool HugoMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
diff --git a/engines/glk/level9/detection.cpp b/engines/glk/level9/detection.cpp
index e621ad041bd..abe9c9d6308 100644
--- a/engines/glk/level9/detection.cpp
+++ b/engines/glk/level9/detection.cpp
@@ -716,7 +716,7 @@ GameDescriptor Level9MetaEngine::findGame(const char *gameId) {
 		}
 	}
 
-	return PlainGameDescriptor();
+	return PlainGameDescriptor::empty();
 }
 
 bool Level9MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
index 539ccc8ef3a..3504bc16e7e 100644
--- a/engines/glk/magnetic/detection.cpp
+++ b/engines/glk/magnetic/detection.cpp
@@ -41,7 +41,7 @@ GameDescriptor MagneticMetaEngine::findGame(const char *gameId) {
 			return *pd;
 	}
 
-	return PlainGameDescriptor();
+	return PlainGameDescriptor::empty();
 }
 
 bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {




More information about the Scummvm-git-logs mailing list