PdfSharpCore icon indicating copy to clipboard operation
PdfSharpCore copied to clipboard

XTextFormatter : block.Text.Trim() can throw a NullReferenceException since 1.3.67

Open DjeeBay opened this issue 9 months ago • 0 comments

Hi,

In the DrawString method, if the string text parameter contains \r\n it will throw a NullReferenceException. The new code in XTextFormatter.cs L.231 does a block.Text.Trim() but the Text property is null when block.Type is BlockType.LineBreak.

There are maybe other cases where Text can be null but LineBreak is the first I've encountered.

DjeeBay avatar Apr 17 '25 12:04 DjeeBay