Merge pull request #2057 from Diapolo/FlushBlockFile

FlushBlockFile(): check for valid FILE pointer
This commit is contained in:
Pieter Wuille 2012-12-06 01:35:36 -08:00
commit d79775a04d

View file

@ -1538,12 +1538,16 @@ void static FlushBlockFile()
CDiskBlockPos posOld(nLastBlockFile, 0);
FILE *fileOld = OpenBlockFile(posOld);
FileCommit(fileOld);
fclose(fileOld);
if (fileOld) {
FileCommit(fileOld);
fclose(fileOld);
}
fileOld = OpenUndoFile(posOld);
FileCommit(fileOld);
fclose(fileOld);
if (fileOld) {
FileCommit(fileOld);
fclose(fileOld);
}
}
bool FindUndoPos(int nFile, CDiskBlockPos &pos, unsigned int nAddSize);