mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
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:
@@ -400,7 +400,13 @@ namespace UglyToad.PdfPig.Writer
|
|||||||
var val = kvp.Value;
|
var val = kvp.Value;
|
||||||
if (kvp.Value is IndirectReferenceToken ir)
|
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))
|
if (!(val is ArrayToken arr))
|
||||||
|
|||||||
Reference in New Issue
Block a user