Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: fpdfsdk/src/fpdfview.cpp

Issue 837723009: Add tests for GetNamedDests() API. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 80 columns Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfview.cpp
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 43feaf4d5a9154999eb40c893fbe60ef5b59337a..853d7f76074fe84c5d0f481e506cfdcbd5cfd2ea 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -848,8 +848,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();
@@ -860,8 +862,9 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
memcpy(buffer, utf16Name.c_str(), len);
((FX_BYTE*)buffer)[len] = 0;
((FX_BYTE*)buffer)[len + 1] = 0;
+ buflen = len + 2;
} else {
- len = -1;
+ buflen = -1;
}
return (FPDF_DEST)pDestObj;
}
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698