NullReferenceException when creating invoice line items

Getting this error when I try and add lines to a new sales invoice:

 

                        // Create invoice

                        var invoice = Company.Factories.SalesInvoiceFactory.Create();

 

                        // Invoice #, Date, Customer ID

                        invoice.CustomerReference = customer.Key;

                        invoice.ReferenceNumber = drExport.Field<string>("RefNumber");

                        invoice.Date = drExport.Field<DateTime>("InvoiceDate");

 

                            // Create line item

                            var invoiceLine = invoice.AddSalesLine();

                            invoiceLine.Amount = amount ?? 0;

                            invoiceLine.Quantity = qty ?? 0;

                            invoiceLine.InventoryItemReference = sageItem.Key;

                            invoiceLine.Description = desc;

                            invoiceLine.UnitPrice = invoiceLine.CalculateUnitCost(qty ?? 0, amount ?? 0);

                            invoiceLine.SalesTaxType = salesTax != 0 ? 1 : 2; // Tax type 1 = Regular, 2 = Exempt

 

 

System.NullReferenceException: Object reference not set to an instance of an object

   at Sage.Peachtree.Domain.Entities.SalesInvoice.AddSalesInvoiceSalesLine()

   at Sage.Peachtree.API.SalesInvoice.AddSalesLine()

   at Synectic.VendSys.Integration.Integrators.SageIntegrator.DoSalesInvoiceExport(IExport export, IntegrationResult& result) in C:\TFS\VendSys\Integration\Integrators\SageIntegrator.cs:line 668

 

I have a valid Invoice object, the null reference exception is coming from inside the Sage SDK somewhere (in Sage.Peachtree.Domain)

As you can see above the Invoice object is not null, why is it throwing a NullReferenceException?