minor modifications to avoid NPEs in property group property list handling

This commit is contained in:
brianjlowe 2011-10-06 18:17:00 +00:00
parent 85d21c5c59
commit adf5558aa4
2 changed files with 4 additions and 2 deletions

View file

@ -106,7 +106,7 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
} }
public GroupedPropertyList getPropertyList() { public GroupedPropertyList getPropertyList() {
if (propertyList == null) { if (!(propertyList instanceof GroupedPropertyList)) {
propertyList = new GroupedPropertyList(individual, vreq, policyHelper); propertyList = new GroupedPropertyList(individual, vreq, policyHelper);
} }
return propertyList; return propertyList;

View file

@ -337,7 +337,9 @@ public class GroupedPropertyList extends BaseTemplateModel {
// Clear out the property lists on the groups // Clear out the property lists on the groups
for (PropertyGroup pg : groupList) { for (PropertyGroup pg : groupList) {
if (pg.getPropertyList().size() > 0) { if (pg.getPropertyList() == null) {
pg.setPropertyList(new ArrayList<Property>());
} else if (pg.getPropertyList().size() > 0) {
pg.getPropertyList().clear(); pg.getPropertyList().clear();
} }
} }