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

criezy criezy at scummvm.org
Mon Apr 24 21:07:10 CEST 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5d91efa74d BASE: Check scanf return value when adding a game
ae8944e104 BASE: Improve error handling when detecting games


Commit: 5d91efa74d2f3228c88c9af01541e0e2d7912d47
    https://github.com/scummvm/scummvm/commit/5d91efa74d2f3228c88c9af01541e0e2d7912d47
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T20:04:05+01:00

Commit Message:
BASE: Check scanf return value when adding a game

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index e77ab6c..4f3d568 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -889,7 +889,10 @@ static bool addGame(Common::String path) {
 		}
 
 		// Get user input
-		scanf("%i", &idx);
+		if (scanf("%i", &idx) != 1) {
+			printf("Invalid index. No game added.\n");
+			return false;
+		}
 		--idx;
 		if (idx < 0 || idx >= (int)candidates.size()) {
 			printf("Invalid index. No game added.\n");


Commit: ae8944e1044b6bfc00f380aba08cebbe5439d9d6
    https://github.com/scummvm/scummvm/commit/ae8944e1044b6bfc00f380aba08cebbe5439d9d6
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-04-24T20:04:05+01:00

Commit Message:
BASE: Improve error handling when detecting games

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 4f3d568..15f064f 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -810,7 +810,10 @@ static GameList getGameList(Common::String path) {
 	Common::FSList files;
 
 	//Collect all files from directory
-	dir.getChildren(files, Common::FSNode::kListAll);
+	if (!dir.getChildren(files, Common::FSNode::kListAll)) {
+		printf("Path %s does not exist or is not a directory.\n", path.c_str());
+		return GameList();
+	}
 
 	// detect Games
 	GameList candidates(EngineMan.detectGames(files));
@@ -928,7 +931,8 @@ static bool massAddGame(Common::String path) {
 		Common::String dataPath = dir.getPath();
 
 		//Collect all files from directory
-		dir.getChildren(files, Common::FSNode::kListAll);
+		if (!dir.getChildren(files, Common::FSNode::kListAll))
+			continue;
 
 		// Get game list and add games
 		GameList candidates(EngineMan.detectGames(files));





More information about the Scummvm-git-logs mailing list