mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Only reset missed attempts count if table is found in CrossReferenceParser.Parse() and fix #1047
This commit is contained in:
@@ -7,6 +7,15 @@
|
|||||||
|
|
||||||
public class GithubIssuesTests
|
public class GithubIssuesTests
|
||||||
{
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Issue1047()
|
||||||
|
{
|
||||||
|
var path = IntegrationHelpers.GetSpecificTestDocumentPath("Hang.pdf");
|
||||||
|
|
||||||
|
var ex = Assert.Throws<PdfDocumentFormatException>(() => PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }));
|
||||||
|
Assert.Equal("The cross reference was not found.", ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Issue1048()
|
public void Issue1048()
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -10,7 +10,7 @@
|
|||||||
using Tokenization.Scanner;
|
using Tokenization.Scanner;
|
||||||
using Tokens;
|
using Tokens;
|
||||||
|
|
||||||
internal class CrossReferenceParser
|
internal sealed class CrossReferenceParser
|
||||||
{
|
{
|
||||||
private readonly ILog log;
|
private readonly ILog log;
|
||||||
private readonly XrefOffsetValidator offsetValidator;
|
private readonly XrefOffsetValidator offsetValidator;
|
||||||
@@ -151,8 +151,6 @@
|
|||||||
{
|
{
|
||||||
log.Debug("Element was cross reference stream.");
|
log.Debug("Element was cross reference stream.");
|
||||||
|
|
||||||
missedAttempts = 0;
|
|
||||||
|
|
||||||
// Unread the numeric token.
|
// Unread the numeric token.
|
||||||
tokenScanner.Seek(previousCrossReferenceLocation);
|
tokenScanner.Seek(previousCrossReferenceLocation);
|
||||||
|
|
||||||
@@ -169,6 +167,8 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
missedAttempts = 0;
|
||||||
|
|
||||||
table.Add(tablePart);
|
table.Add(tablePart);
|
||||||
|
|
||||||
previousCrossReferenceLocation = tablePart.Previous;
|
previousCrossReferenceLocation = tablePart.Previous;
|
||||||
|
|||||||
Reference in New Issue
Block a user