diff options
| author | Philip Kaufmann <[email protected]> | 2012-12-01 11:36:53 +0100 |
|---|---|---|
| committer | Philip Kaufmann <[email protected]> | 2012-12-01 11:36:53 +0100 |
| commit | b19388dd88ebfcc49caf21511530ba5faad1ccf1 (patch) | |
| tree | b4e8f439de0ca5bd699cd2205072b36119cb77b9 /src/main.cpp | |
| parent | Merge pull request #2033 from sipa/kickconflicts (diff) | |
| download | discoin-b19388dd88ebfcc49caf21511530ba5faad1ccf1.tar.xz discoin-b19388dd88ebfcc49caf21511530ba5faad1ccf1.zip | |
FlushBlockFile(): check for valid FILE pointer
- don't call FileCommit() and fclose() if no valid FILE pointer was
returned by OpenBlockFile()
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 944345abb..7516f4011 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1540,12 +1540,16 @@ void static FlushBlockFile() posOld.nPos = 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); |