diff options
-rw-r--r-- | src/game.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -37,6 +37,12 @@ db_games_find(const char *games_dir, char ***games) int i; n = scandir(games_dir, &entries, &_db_game_is_dir, alphasort); + if (n < 0) { + db_err("Failed to scan games directory"); + return -1; + } else if (n == 0) { + return 0; + } *games = calloc(n, sizeof(**games)); if (*games == NULL) { |