aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFEmbeddedFileDocumentHelper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFEmbeddedFileDocumentHelper.cc')
-rw-r--r--libqpdf/QPDFEmbeddedFileDocumentHelper.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libqpdf/QPDFEmbeddedFileDocumentHelper.cc b/libqpdf/QPDFEmbeddedFileDocumentHelper.cc
index 826e0d87..4b61dfe3 100644
--- a/libqpdf/QPDFEmbeddedFileDocumentHelper.cc
+++ b/libqpdf/QPDFEmbeddedFileDocumentHelper.cc
@@ -62,8 +62,8 @@ QPDFEmbeddedFileDocumentHelper::initEmbeddedFiles()
auto root = qpdf.getRoot();
auto names = root.getKey("/Names");
if (!names.isDictionary()) {
- names = QPDFObjectHandle::newDictionary();
- root.replaceKey("/Names", names);
+ names =
+ root.replaceKeyAndGet("/Names", QPDFObjectHandle::newDictionary());
}
auto embedded_files = names.getKey("/EmbeddedFiles");
if (!embedded_files.isDictionary()) {