aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r--src/util/system.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 43c6ae54ab..2ed9cf7048 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1047,8 +1047,10 @@ void DirectoryCommit(const fs::path &dirname)
{
#ifndef WIN32
FILE* file = fsbridge::fopen(dirname, "r");
- fsync(fileno(file));
- fclose(file);
+ if (file) {
+ fsync(fileno(file));
+ fclose(file);
+ }
#endif
}