Commit 8ff714de authored by Jerome Flesch's avatar Jerome Flesch

Tesseract C-API: TessResultIteratorGetUTF8Text can return NULL in some cases

Signed-off-by: Jerome Flesch's avatarJerome Flesch <>
parent e58948ca
......@@ -476,6 +476,8 @@ def result_iterator_get_page_iterator(res_iterator):
def result_iterator_get_utf8_text(iterator, level):
ptr = g_libtesseract.TessResultIteratorGetUTF8Text(iterator, level)
if ptr is None:
return None
val = ctypes.cast(ptr, ctypes.c_char_p).value.decode("utf-8")[:]
return val
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment