summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-05 13:39:22 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-05 18:49:58 +0000
commit8eeee77cbe0a2eb5729697767a3c503fc5570005 (patch)
treea54c03ab0c620567f840b3c92c8759c3c41f36d5 /fpdfsdk
parent2c0ca7ddbc38e33cc692b2be02c32419b97927e0 (diff)
downloadpdfium-8eeee77cbe0a2eb5729697767a3c503fc5570005.tar.xz
Convert CPDF_PageLabel::GetLabel to return Optional<WideString>
Change-Id: I53b91aa89c0fd1e7ab766f6d3c27a0fc7573c360 Reviewed-on: https://pdfium-review.googlesource.com/22290 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk')
-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;
}