summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 344cdad..268e42e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,11 +23,13 @@ main(int argc, char *argv[])
}
free(program_dir);
n = db_games_find(games_dir, &games);
- printf("%d games:\n", n);
- for (i = 0; i < n; ++i) {
- printf("\t%s\n", games[i]);
- free(games[i]);
+ if (n > 0) {
+ printf("%d games:\n", n);
+ for (i = 0; i < n; ++i) {
+ printf("\t%s\n", games[i]);
+ free(games[i]);
+ }
+ free(games);
}
- free(games);
return EXIT_SUCCESS;
}