mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #77: Document read error
This commit is contained in:
@ -65,12 +65,17 @@ void PDFOutlineItem::parseImpl(const PDFObjectStorage* storage,
|
|||||||
{
|
{
|
||||||
if (visitedOutlineItems.count(reference))
|
if (visitedOutlineItems.count(reference))
|
||||||
{
|
{
|
||||||
throw PDFException(PDFTranslationContext::tr("Outline items have cyclic dependence."));
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
visitedOutlineItems.insert(reference);
|
visitedOutlineItems.insert(reference);
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
checkCyclicDependence(currentItem);
|
|
||||||
|
if (!checkCyclicDependence(currentItem))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PDFObject dereferencedItem = storage->getObjectByReference(currentItem);
|
PDFObject dereferencedItem = storage->getObjectByReference(currentItem);
|
||||||
while (dereferencedItem.isDictionary())
|
while (dereferencedItem.isDictionary())
|
||||||
@ -106,7 +111,8 @@ void PDFOutlineItem::parseImpl(const PDFObjectStorage* storage,
|
|||||||
const PDFObject& firstItem = dictionary->get("First");
|
const PDFObject& firstItem = dictionary->get("First");
|
||||||
if (firstItem.isReference())
|
if (firstItem.isReference())
|
||||||
{
|
{
|
||||||
parseImpl(storage, currentOutlineItem.get(), firstItem.getReference(), visitedOutlineItems);
|
std::set<PDFObjectReference> currentVisitedOutlineItems = visitedOutlineItems;
|
||||||
|
parseImpl(storage, currentOutlineItem.get(), firstItem.getReference(), currentVisitedOutlineItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new child to the parent
|
// Add new child to the parent
|
||||||
@ -116,7 +122,10 @@ void PDFOutlineItem::parseImpl(const PDFObjectStorage* storage,
|
|||||||
const PDFObject& nextItem = dictionary->get("Next");
|
const PDFObject& nextItem = dictionary->get("Next");
|
||||||
if (nextItem.isReference())
|
if (nextItem.isReference())
|
||||||
{
|
{
|
||||||
checkCyclicDependence(nextItem.getReference());
|
if (!checkCyclicDependence(nextItem.getReference()))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
dereferencedItem = storage->getObject(nextItem);
|
dereferencedItem = storage->getObject(nextItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user