avoid nullpointer

This commit is contained in:
Peter Hormanns 2016-08-16 19:01:21 +02:00
parent 2ea8be3b51
commit be86a63ef9

View File

@ -68,6 +68,7 @@ public class PacVO extends AbstractVO implements ValueObject {
@ReadWrite(ReadWritePolicy.READWRITE) @ReadWrite(ReadWritePolicy.READWRITE)
@Display(sequence=70) @Display(sequence=70)
@Search(SearchPolicy.EQUALS)
private Boolean free; private Boolean free;
@Required(true) @Required(true)
@ -167,12 +168,15 @@ public class PacVO extends AbstractVO implements ValueObject {
if ("pacComponents".equals(p.getName())) { if ("pacComponents".equals(p.getName())) {
if (persistentObject instanceof Pac) { if (persistentObject instanceof Pac) {
final Pac persistentPac = (Pac) persistentObject; final Pac persistentPac = (Pac) persistentObject;
for (final PacComponentVO componentVO : getPacComponents()) { final List<PacComponentVO> pacComps = getPacComponents();
if (pacComps != null) {
for (final PacComponentVO componentVO : pacComps) {
final String feature = componentVO.getFeature(); final String feature = componentVO.getFeature();
final Integer quantity = componentVO.getQuantity(); final Integer quantity = componentVO.getQuantity();
persistentPac.getPacComponent(feature).setQuantity(quantity); persistentPac.getPacComponent(feature).setQuantity(quantity);
} }
} }
}
} else { } else {
p.copyValueToPersistentObject(persistentObject); p.copyValueToPersistentObject(persistentObject);
} }