summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-01-22 11:20:06 -0800
committerTom Sepez <tsepez@chromium.org>2015-01-22 11:20:06 -0800
commitc8f6ab628c4bdf90dcee3d5ac153beb043a42f92 (patch)
treefa9d7cfadb37a382ce08bffcecad897d33ff04a8 /fpdfsdk/src/fpdfview.cpp
parent70ad112e874cd076144cc1254db254ee651b5c81 (diff)
downloadpdfium-c8f6ab628c4bdf90dcee3d5ac153beb043a42f92.tar.xz
Merge to XFA: Add embeddertests.
This brings in: 83f96a0 Add API tests: NamedDestsByName, DestGetPageIndex. 9dcd7b8 Add tests for GetNamedDests() API. TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/849693007
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 4114dac01c..feec289614 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -1048,8 +1048,10 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
pDestObj = nameTree.LookupValue(index, bsName);
}
if (!pDestObj) return NULL;
- if (pDestObj->GetType() == PDFOBJ_DICTIONARY)
+ if (pDestObj->GetType() == PDFOBJ_DICTIONARY) {
pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D"));
+ if (!pDestObj) return NULL;
+ }
if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL;
CFX_WideString wsName = PDF_DecodeText(bsName);
CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
@@ -1058,6 +1060,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
buflen = len;
} else if (buflen >= len) {
memcpy(buffer, utf16Name.c_str(), len);
+ buflen = len;
} else {
buflen = -1;
}