diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/commandLine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index e77ab6ce86..4f3d5687b4 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"); |