Empty font name throw exception

Aug 9, 2013 at 8:05 AM
duplicate issue "ITEM NUMBER:12000" - https://netdxf.codeplex.com/workitem/12000
hoping for fast answer pleeease.

Sometimes there are
            DxfDocument dxf = DxfDocument.Load(fileName);
dxf is null because of thrown unhandled exception in
TextStyle construction

if (string.IsNullOrEmpty(font))
     throw (new ArgumentNullException("font"));
i think you should some standart font in this situation or just skip font name initialization.

Redards Dmitry.
Coordinator
Aug 11, 2013 at 10:35 AM
The font parameter is needed. The problem is that AutoCad is very permissive with some kind of errors in the dxf files. This is not the first time that a problem like this has arisen, I am being more strict, but it has a easy workaround, during the reading process of the TextStyle a simple check like
if (string.IsNullOrEmpty(font)) font = TextStyle.Default.FontName;
should solve the problem. I will add this fix on the next update.

Daniel