summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index d542e8cb32..f76f58ad0b 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -602,7 +602,10 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
CPDF_Stream* pNormalStream = pDoc->NewIndirect<CPDF_Stream>();
pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize());
- CPDF_Dictionary* pAPDict = pAnnotDict->SetNewFor<CPDF_Dictionary>("AP");
+ CPDF_Dictionary* pAPDict = pAnnotDict->GetDictFor("AP");
+ if (!pAPDict)
+ pAPDict = pAnnotDict->SetNewFor<CPDF_Dictionary>("AP");
+
pAPDict->SetNewFor<CPDF_Reference>("N", pDoc, pNormalStream->GetObjNum());
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();