Fix crash if output file could not be opened

This error case results in fout_ == nullptr.
Closing a nullptr file is not allowed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2017-05-13 17:26:42 +02:00
parent 6bebe71749
commit 84396707a8

View File

@ -47,10 +47,12 @@ TessResultRenderer::TessResultRenderer(const char *outputbase,
}
TessResultRenderer::~TessResultRenderer() {
if (fout_ != stdout)
fclose(fout_);
else
clearerr(fout_);
if (fout_ != nullptr) {
if (fout_ != stdout)
fclose(fout_);
else
clearerr(fout_);
}
delete next_;
}