diff --git a/poppler/XRef.cc b/poppler/XRef.cc index dfc6d73..df113f6 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -1352,7 +1352,7 @@ XRefEntry *XRef::getEntry(int i, GBool complainIfMissing) // if there was a problem with the xref table, // try to reconstruct it - if (!ok) { + if (!ok || (entries[i].type == xrefEntryNone && complainIfMissing)) { GBool wasReconstructed = false; if (!(ok = constructXRef(&wasReconstructed))) { errCode = errDamaged; @@ -1361,7 +1361,7 @@ XRefEntry *XRef::getEntry(int i, GBool complainIfMissing) break; } } - + // We might have reconstructed the xref // Check again i is in bounds if (unlikely(i >= size)) {