summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_dictionary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_dictionary.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 1ede5e707a..5257a20586 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -130,7 +130,19 @@ bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) const {
+const CPDF_Dictionary* CPDF_Dictionary::GetDictFor(
+ const ByteString& key) const {
+ CPDF_Object* p = GetDirectObjectFor(key);
+ if (!p)
+ return nullptr;
+ if (CPDF_Dictionary* pDict = p->AsDictionary())
+ return pDict;
+ if (CPDF_Stream* pStream = p->AsStream())
+ return pStream->GetDict();
+ return nullptr;
+}
+
+CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) {
CPDF_Object* p = GetDirectObjectFor(key);
if (!p)
return nullptr;