From 8eeee77cbe0a2eb5729697767a3c503fc5570005 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 5 Jan 2018 13:39:22 -0500 Subject: Convert CPDF_PageLabel::GetLabel to return Optional Change-Id: I53b91aa89c0fd1e7ab766f6d3c27a0fc7573c360 Reviewed-on: https://pdfium-review.googlesource.com/22290 Commit-Queue: Ryan Harrison Reviewed-by: Henrique Nakashima --- fpdfsdk/fpdfdoc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fpdfsdk') 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 str = label.GetLabel(page_index); + return str.has_value() + ? Utf16EncodeMaybeCopyAndReturnLength(str.value(), buffer, buflen) + : 0; } -- cgit v1.2.3