summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdftext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 2ea06de5d8..8ed76ea7c1 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -250,7 +250,9 @@ FPDFText_FindStart(FPDF_TEXTPAGE text_page,
new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page));
FX_STRSIZE len = CFX_WideString::WStringLength(findwhat);
textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags,
- start_index);
+ start_index >= 0
+ ? pdfium::Optional<FX_STRSIZE>(start_index)
+ : pdfium::Optional<FX_STRSIZE>());
return textpageFind;
}