IDEMPIERE-4189 Fix potential NPE in generate shipment - based on patch from Martin Schönbeck

This commit is contained in:
Carlos Ruiz 2020-02-24 14:14:34 +01:00
parent 0871b81c87
commit 04001e1055
1 changed files with 8 additions and 6 deletions

View File

@ -257,14 +257,11 @@ public class InOutGenerate extends SvrProcess
BigDecimal onHand = Env.ZERO; BigDecimal onHand = Env.ZERO;
BigDecimal toDeliver = line.getQtyOrdered() BigDecimal toDeliver = line.getQtyOrdered()
.subtract(line.getQtyDelivered()); .subtract(line.getQtyDelivered());
MProduct product = line.getProduct();
// Nothing to Deliver // Nothing to Deliver
if (product != null && toDeliver.signum() == 0) if (toDeliver.signum() == 0)
continue;
// or it's a charge - Bug#: 1603966
if (line.getC_Charge_ID()!=0 && toDeliver.signum() == 0)
continue; continue;
MProduct product = line.getProduct();
// Check / adjust for confirmations // Check / adjust for confirmations
BigDecimal unconfirmedShippedQty = Env.ZERO; BigDecimal unconfirmedShippedQty = Env.ZERO;
@ -298,6 +295,11 @@ public class InOutGenerate extends SvrProcess
createLine (order, line, toDeliver, null, false); createLine (order, line, toDeliver, null, false);
continue; continue;
} }
if (product == null)
{
// code must never arrive here - but for safety against NPE
continue;
}
// Stored Product // Stored Product
String MMPolicy = product.getMMPolicy(); String MMPolicy = product.getMMPolicy();