diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-12-06 01:35:36 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-12-06 01:35:36 -0800 |
commit | d79775a04d6dfc03dfc71d7811375a33e1e5c833 (patch) | |
tree | da7298ca12cf40ff41b55166255753a7f103ab4f /src/main.cpp | |
parent | 25fd38090a96fbfc755fb2e3058eafd828e84573 (diff) | |
parent | b19388dd88ebfcc49caf21511530ba5faad1ccf1 (diff) | |
download | bitcoin-d79775a04d6dfc03dfc71d7811375a33e1e5c833.tar.xz |
Merge pull request #2057 from Diapolo/FlushBlockFile
FlushBlockFile(): check for valid FILE pointer
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 756b8ff3d9..ed03414173 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); |