aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-12-06 01:35:36 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2012-12-06 01:35:36 -0800
commitd79775a04d6dfc03dfc71d7811375a33e1e5c833 (patch)
treeda7298ca12cf40ff41b55166255753a7f103ab4f /src/main.cpp
parent25fd38090a96fbfc755fb2e3058eafd828e84573 (diff)
parentb19388dd88ebfcc49caf21511530ba5faad1ccf1 (diff)
Merge pull request #2057 from Diapolo/FlushBlockFile
FlushBlockFile(): check for valid FILE pointer
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
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);