mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
Catch nullptr in PageIterator::Orientation to improve robustness
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
31a968432d
commit
443933a75a
@ -566,7 +566,15 @@ void PageIterator::Orientation(tesseract::Orientation *orientation,
|
||||
tesseract::WritingDirection *writing_direction,
|
||||
tesseract::TextlineOrder *textline_order,
|
||||
float *deskew_angle) const {
|
||||
BLOCK *block = it_->block()->block;
|
||||
auto *block_res = it_->block();
|
||||
if (block_res == nullptr) {
|
||||
// Nothing can be done, so return default values.
|
||||
*orientation = ORIENTATION_PAGE_UP;
|
||||
*writing_direction = WRITING_DIRECTION_LEFT_TO_RIGHT;
|
||||
*textline_order = TEXTLINE_ORDER_TOP_TO_BOTTOM;
|
||||
return;
|
||||
}
|
||||
auto *block = block_res->block;
|
||||
|
||||
// Orientation
|
||||
FCOORD up_in_image(0.0, 1.0);
|
||||
|
Loading…
Reference in New Issue
Block a user