aboutsummaryrefslogtreecommitdiff
path: root/base/commandLine.cpp
diff options
context:
space:
mode:
authorThierry Crozat2017-04-24 20:03:52 +0100
committerThierry Crozat2017-04-24 20:04:05 +0100
commitae8944e1044b6bfc00f380aba08cebbe5439d9d6 (patch)
treebd1e4cc322dd9f4a3dbaa172f5b061a628c38738 /base/commandLine.cpp
parent5d91efa74d2f3228c88c9af01541e0e2d7912d47 (diff)
downloadscummvm-rg350-ae8944e1044b6bfc00f380aba08cebbe5439d9d6.tar.gz
scummvm-rg350-ae8944e1044b6bfc00f380aba08cebbe5439d9d6.tar.bz2
scummvm-rg350-ae8944e1044b6bfc00f380aba08cebbe5439d9d6.zip
BASE: Improve error handling when detecting games
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r--base/commandLine.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 4f3d5687b4..15f064f9e3 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));