UNIT6-open / TemplateEngine.Docx

Smart docx template engine for .NET
Other
408 stars 136 forks source link

Add null checks in SdtTagName #63

Open thomas-taylor opened 4 years ago

thomas-taylor commented 4 years ago

SdtTagName was throwing lots of exceptions, so I downloaded your code and took a look in debug mode. The ".Element(W.tag)" part was null. I added null checks (via the question marks), and it solved my problem and seems to run quite a bit faster. I did not spend any time trying to understand your code, but if the try/catch is there just for handling nulls, maybe that is no longer needed.