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