diff --git a/src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java b/src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java
--- a/src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java
+++ b/src/org/openbravo/contract/services/process/billing/StandardContractInvoiceProcess.java
@@ -502,7 +502,11 @@
     }
     PaymentTerm paymentTerm = contractLine.getPaymentTerms();
     if (paymentTerm == null) {
-      paymentTerm = contractHeader.getPaymentTerms();
+     if (contractHeader != null) {
+        paymentTerm = contractHeader.getPaymentTerms();
+     } else {
+       throw new OBException("Contract "+contractLine.getIdentifier()+ " has not selected payment term");
+     }
     }
     if (blockInvoice) {
       invoiceType = SCConstants.INVOICE_BLOCKED;
