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