Skip to content

Commit 609d902

Browse files
authored
fix: handle empty result from RapidOCR to avoid crash (#2264)
Signed-off-by: Junehyuk Park <[email protected]>
1 parent 10bb0ae commit 609d902

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docling/models/rapid_ocr_model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def __call__(
120120
use_cls=self.options.use_cls,
121121
use_rec=self.options.use_rec,
122122
)
123+
if result is None or result.boxes is None:
124+
_log.warning("RapidOCR returned empty result!")
125+
continue
123126
result = list(
124127
zip(result.boxes.tolist(), result.txts, result.scores)
125128
)

0 commit comments

Comments
 (0)