diff --git a/libqpdf/QPDFOutlineDocumentHelper.cc b/libqpdf/QPDFOutlineDocumentHelper.cc index 45ed696a..b1157125 100644 --- a/libqpdf/QPDFOutlineDocumentHelper.cc +++ b/libqpdf/QPDFOutlineDocumentHelper.cc @@ -68,30 +68,25 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) QPDFObjectHandle result; if (name.isName()) { if (!m->dest_dict.isInitialized()) { - m->dest_dict = this->qpdf.getRoot().getKey("/Dests"); - } - if (m->dest_dict.isDictionary()) { - QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest"); - result = m->dest_dict.getKey(name.getName()); + m->dest_dict = qpdf.getRoot().getKey("/Dests"); } + QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest"); + result= m->dest_dict.getKeyIfDict(name.getName()); } else if (name.isString()) { - if (nullptr == m->names_dest) { - QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names"); - if (names.isDictionary()) { - QPDFObjectHandle dests = names.getKey("/Dests"); - if (dests.isDictionary()) { - m->names_dest = std::make_shared(dests, this->qpdf); - } + if (!m->names_dest) { + auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests"); + if (dests.isDictionary()) { + m->names_dest = std::make_shared(dests, qpdf); } } - if (m->names_dest.get()) { + if (m->names_dest) { if (m->names_dest->findObject(name.getUTF8Value(), result)) { QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest"); } } } if (!result.isInitialized()) { - result = QPDFObjectHandle::newNull(); + return QPDFObjectHandle::newNull(); } return result; }