util: Check for file being NULL in DirectoryCommit

This commit is contained in:
Luke Dashjr committed 2020-08-25 16:46:46 +00:00
1 parent 4574904038
commit ef712298c3
1 file changed
+4 -2
+4 -2
View File
@@ -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
}