mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
BASE: Check scanf return value when adding a game
This commit is contained in:
parent
0bb8b4051c
commit
5d91efa74d
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user