diff --git a/src/parser.c b/src/parser.c index 8af10ef..4503d1e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -268,12 +268,16 @@ parse_tldrlist(char const *path, char const *platform) if (sstrncat(fullpath, &len, STRBUFSIZ, platform, strlen(platform))) return 1; + directory = opendir(fullpath); + if (directory == NULL) { + fprintf(stderr, "Can't open cache directory."); + return 1; + } + fprintf(stdout, "%s", ANSI_BOLD_ON); fprintf(stdout, "Pages for %s\n", platform); fprintf(stdout, "%s", ANSI_BOLD_OFF); - directory = opendir(fullpath); - while((entry = readdir(directory))) { len = strlen(entry->d_name); if (strcmp(entry->d_name + (len - 3), ".md") != 0)