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.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index cbefb5d56d..a339a8becd 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -197,8 +197,15 @@ void CPDF_Dictionary::ConvertToIndirectObjectFor(
it->second = pdfium::MakeUnique<CPDF_Reference>(pHolder, pObj->GetObjNum());
}
-void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) {
- m_Map.erase(key);
+std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
+ const CFX_ByteString& key) {
+ std::unique_ptr<CPDF_Object> result;
+ auto it = m_Map.find(key);
+ if (it != m_Map.end()) {
+ result = std::move(it->second);
+ m_Map.erase(it);
+ }
+ return result;
}
void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,