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,10 +168,13 @@ 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();
final String feature = componentVO.getFeature(); if (pacComps != null) {
final Integer quantity = componentVO.getQuantity(); for (final PacComponentVO componentVO : pacComps) {
persistentPac.getPacComponent(feature).setQuantity(quantity); final String feature = componentVO.getFeature();
final Integer quantity = componentVO.getQuantity();
persistentPac.getPacComponent(feature).setQuantity(quantity);
}
} }
} }
} else { } else {