summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfdoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfdoc.cpp')
-rw-r--r--fpdfsdk/fpdfdoc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index 51a1c61e77..14e4361483 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -424,8 +424,8 @@ FPDF_GetPageLabel(FPDF_DOCUMENT document,
// CPDF_PageLabel can deal with NULL |document|.
CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document));
- WideString str;
- if (!label.GetLabel(page_index, &str))
- return 0;
- return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen);
+ Optional<WideString> str = label.GetLabel(page_index);
+ return str.has_value()
+ ? Utf16EncodeMaybeCopyAndReturnLength(str.value(), buffer, buflen)
+ : 0;
}