Fixed null ref exception in PdfDocumentBuilder

Fixed null ref exception in PdfDocumentBuilder that occurs when TokenScanner returns null for the IndirectReferenceToken provided.
This commit is contained in:
Zach Langner
2022-03-11 11:44:08 -06:00
committed by GitHub
parent b0a5f4c8d0
commit c8b42f4fd4

View File

@@ -400,7 +400,13 @@ namespace UglyToad.PdfPig.Writer
var val = kvp.Value;
if (kvp.Value is IndirectReferenceToken ir)
{
val = document.Structure.TokenScanner.Get(ir.Data).Data;
ObjectToken tk = document.Structure.TokenScanner.Get(ir.Data);
if (tk == null)
{
// malformed
continue;
}
val = tk.Data;
}
if (!(val is ArrayToken arr))