From 75e6c3ea4c8eae740fb65a84e77dbf0c8d092240 Mon Sep 17 00:00:00 2001 From: MonkeybreadSoftware Date: Wed, 16 Jun 2021 15:35:24 +0200 Subject: [PATCH] Null check for GetSourceYResolution (#3457) * Null check for GetSourceYResolution Added missing NULL check to avoid crash when we read property in our tesseract wrapper. * Added missing return value. added -1 to return if undefined. --- src/api/baseapi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index dccd7f2a..8127b5cd 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -955,6 +955,8 @@ const char *TessBaseAPI::GetDatapath() { } int TessBaseAPI::GetSourceYResolution() { + if (thresholder_ == nullptr) + return -1; return thresholder_->GetSourceYResolution(); }