This project is read-only.

Null reference exception in Type2CIDSubsetFont.get_WArray()


In some circumstances we are getting NullReferfenceException here:
at Fonet.Render.Pdf.Fonts.Type2CIDSubsetFont.get_WArray() in Type2CIDSubsetFont.cs: line 51
at Fonet.Pdf.PdfFontCreator.CreateCIDFont(String pdfFontID, Font font, CIDFont cidFont) in PdfFontCreator.cs: line 123
at Fonet.Pdf.PdfFontCreator.MakeFont(String pdfFontID, Font font) in PdfFontCreator.cs: line 73
at Fonet.Render.Pdf.FontSetup.AddToResources(PdfFontCreator fontCreator, PdfResources resources) in FontSetup.cs: line 187
at Fonet.Render.Pdf.PdfRenderer.StopRenderer() in PdfRenderer.cs: line 230
at Fonet.StreamRenderer.StopRenderer() in StreamRenderer.cs: line 90
at Fonet.Fo.FOTreeBuilder.Parse(XmlReader reader) in FOTreeBuilder.cs: line 241
Sometimes it work, sometimes not - reasons are not clear. We learned that error is reproducible if we add big picture to the document. But some other documents also have big pictures and it is working w/o problem.
Anyway, this could be fixed by accessing property instead of field in line 51 of Type2CIDSubsetFont.cs:
                subsetWidths[subsetIndex] = Widths[glyphIndex];
Property resolves widths if they are not known yet. I'm not sure if it is right place to resolve widths, so if not please advice.