diff --git a/src/UglyToad.PdfPig.Tests/Integration/Documents/Gamebook.pdf b/src/UglyToad.PdfPig.Tests/Integration/Documents/Gamebook.pdf new file mode 100644 index 000000000..d7e5544ef Binary files /dev/null and b/src/UglyToad.PdfPig.Tests/Integration/Documents/Gamebook.pdf differ diff --git a/src/UglyToad.PdfPig.Tests/Integration/GamebookTests.cs b/src/UglyToad.PdfPig.Tests/Integration/GamebookTests.cs new file mode 100644 index 000000000..6d63507f9 --- /dev/null +++ b/src/UglyToad.PdfPig.Tests/Integration/GamebookTests.cs @@ -0,0 +1,19 @@ +namespace UglyToad.PdfPig.Tests.Integration +{ + using Xunit; + + public class GamebookTests + { + [Fact] + public void Issue682() + { + using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("Gamebook.pdf"))) + { + foreach (var page in document.GetPages()) + { + Assert.NotNull(page); + } + } + } + } +} diff --git a/src/UglyToad.PdfPig/Graphics/ReflectionGraphicsStateOperationFactory.cs b/src/UglyToad.PdfPig/Graphics/ReflectionGraphicsStateOperationFactory.cs index a49a26639..d488d169b 100644 --- a/src/UglyToad.PdfPig/Graphics/ReflectionGraphicsStateOperationFactory.cs +++ b/src/UglyToad.PdfPig/Graphics/ReflectionGraphicsStateOperationFactory.cs @@ -129,6 +129,10 @@ public IGraphicsStateOperation Create(OperatorToken op, IReadOnlyList op case SetColorRenderingIntent.Symbol: return new SetColorRenderingIntent((NameToken)operands[0]); case SetFlatnessTolerance.Symbol: + if (operands.Count == 0) + { + return null; // Should not happen by definition + } return new SetFlatnessTolerance(OperandToDecimal(operands[0])); case SetLineCap.Symbol: return new SetLineCap(OperandToInt(operands[0]));