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