Closed sylvainrodrigue closed 3 years ago
Can you send me one of the mails that is giving the error? If so then please sent it to sicos2002@hotmail.com
No response, closed
Hi Sicos1977,
I sent the mail to you about 1 month ago.
Best regards, Sylvain.
For some mails we have received, MsgReader throw an "Object reference not set to an instance of an object" exception when trying to load the mail.
The problem begins in DomDocuments, line 794:long 809:
_fontChartset var fontName = FontTable.GetFontName(reader.Parameter);
In my case, FontTable contains 5 items and reader.Parameter == 5. The font is not found so MsgReader uses the default font, which is "Microsoft Sans Serif":
fontName = DefaultFontName;
The exception is thrown at the next line since FontTable[5] doesn't exist:
_fontChartset = FontTable[reader.Parameter].Encoding;
I suppose that fontChartset should use the default font encoding when the font doesn't exits. This is how I fixed it for my project.
Context: C# WebAPI usgin .NET Framework 4.6 on Windows 2016 server.
Note: MsgReader is a great tools, thank you to have made it open source!