Added check for null template

This commit is contained in:
John Jenko 2013-12-13 16:07:47 +00:00
parent 6170cd205b
commit b414bfbe12

View File

@ -205,7 +205,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (_TopTemplateTypes == null) if (_TopTemplateTypes == null && Templates != null)
{ {
_TopTemplateTypes = new Dictionary<int, int>(); _TopTemplateTypes = new Dictionary<int, int>();
// loop through all of templates to find those that are top level, i.e. // loop through all of templates to find those that are top level, i.e.
@ -231,6 +231,7 @@ namespace VEPROMS.CSLA.Library
NewTemplateFormat = false; NewTemplateFormat = false;
// count newlines - which gives number of template records. // count newlines - which gives number of template records.
int NumTemplates = 0; int NumTemplates = 0;
if (TPL == null) return null;
int indx = TPL.IndexOf('\n'); int indx = TPL.IndexOf('\n');
while (indx > -1) while (indx > -1)
{ {