aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--noice.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/noice.c b/noice.c
index 27a4b32..4c88701 100644
--- a/noice.c
+++ b/noice.c
@@ -552,9 +552,11 @@ out:
free(dents[i].name);
free(dents);
- r = closedir(dirp);
- if (r == -1)
- printerr(1, "closedir");
+ if (dirp != NULL) {
+ r = closedir(dirp);
+ if (r == -1)
+ printerr(1, "closedir");
+ }
goto begin;
}