A property of a model could cause a null reference exception 

A null reference exception could occure for a string property if the property is a member of an item in collection which is a member of the model. 
Model.Collection[0].Property == null

In this case the generated code uses the WriteTo method instead of the Write method. The Write method checks the TemplateWriter parameter for null to prevent the null reference exception. This check is missing in the WriteTo method.