summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 9f8ab7878f..d1baef5052 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -142,9 +142,9 @@ uint32_t CPDF_Annot::GetFlags() const {
CPDF_Stream* FPDFDOC_GetAnnotAP(const CPDF_Dictionary* pAnnotDict,
CPDF_Annot::AppearanceMode mode) {
CPDF_Dictionary* pAP = pAnnotDict->GetDictFor("AP");
- if (!pAP) {
+ if (!pAP)
return nullptr;
- }
+
const char* ap_entry = "N";
if (mode == CPDF_Annot::Down)
ap_entry = "D";
@@ -159,22 +159,20 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(const CPDF_Dictionary* pAnnotDict,
if (CPDF_Stream* pStream = psub->AsStream())
return pStream;
- if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
- ByteString as = pAnnotDict->GetStringFor("AS");
- if (as.IsEmpty()) {
- ByteString value = pAnnotDict->GetStringFor("V");
- if (value.IsEmpty()) {
- CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
- value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
- }
- if (value.IsEmpty() || !pDict->KeyExist(value))
- as = "Off";
- else
- as = value;
+ CPDF_Dictionary* pDict = psub->AsDictionary();
+ if (!pDict)
+ return nullptr;
+
+ ByteString as = pAnnotDict->GetStringFor("AS");
+ if (as.IsEmpty()) {
+ ByteString value = pAnnotDict->GetStringFor("V");
+ if (value.IsEmpty()) {
+ CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
+ value = pParentDict ? pParentDict->GetStringFor("V") : ByteString();
}
- return pDict->GetStreamFor(as);
+ as = (!value.IsEmpty() && pDict->KeyExist(value)) ? value : "Off";
}
- return nullptr;
+ return pDict->GetStreamFor(as);
}
CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {