Skip to content

Commit ef71229

Browse files
committed
util: Check for file being NULL in DirectoryCommit
1 parent 4574904 commit ef71229

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/util/system.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,10 @@ void DirectoryCommit(const fs::path &dirname)
10471047
{
10481048
#ifndef WIN32
10491049
FILE* file = fsbridge::fopen(dirname, "r");
1050-
fsync(fileno(file));
1051-
fclose(file);
1050+
if (file) {
1051+
fsync(fileno(file));
1052+
fclose(file);
1053+
}
10521054
#endif
10531055
}
10541056

0 commit comments

Comments
 (0)