mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-13 07:59:04 +08:00
Fix CID 1393239 (Dereference null return value)
Add also some error handling if fopen fails. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
b344dc14ad
commit
27a5908a55
@ -1195,8 +1195,12 @@ bool TessBaseAPI::ProcessPage(Pix* pix, int page_index, const char* filename,
|
||||
if (failed && retry_config != nullptr && retry_config[0] != '\0') {
|
||||
// Save current config variables before switching modes.
|
||||
FILE* fp = fopen(kOldVarsFile, "wb");
|
||||
PrintVariables(fp);
|
||||
fclose(fp);
|
||||
if (fp == nullptr) {
|
||||
tprintf("Error, failed to open file \"%s\"\n", kOldVarsFile);
|
||||
} else {
|
||||
PrintVariables(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
// Switch to alternate mode for retry.
|
||||
ReadConfigFile(retry_config);
|
||||
SetImage(pix);
|
||||
|
Loading…
Reference in New Issue
Block a user