diff --git a/public/built.js b/public/built.js index a883d6a372..a61e797a36 100644 --- a/public/built.js +++ b/public/built.js @@ -31403,9 +31403,11 @@ NINJA.invoiceDocuments = function(invoice) { var j = 0; for (var i = 0; i < invoice.documents.length; i++)addDoc(invoice.documents[i]); - for (var i = 0; i < invoice.expenses.length; i++) { - var expense = invoice.expenses[i]; - for (var i = 0; i < expense.documents.length; i++)addDoc(expense.documents[i]); + if(invoice.expenses){ + for (var i = 0; i < invoice.expenses.length; i++) { + var expense = invoice.expenses[i]; + for (var i = 0; i < expense.documents.length; i++)addDoc(expense.documents[i]); + } } function addDoc(document){ diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 9f38f6e42f..cc09165709 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -411,9 +411,11 @@ NINJA.invoiceDocuments = function(invoice) { var j = 0; for (var i = 0; i < invoice.documents.length; i++)addDoc(invoice.documents[i]); - for (var i = 0; i < invoice.expenses.length; i++) { - var expense = invoice.expenses[i]; - for (var i = 0; i < expense.documents.length; i++)addDoc(expense.documents[i]); + if(invoice.expenses){ + for (var i = 0; i < invoice.expenses.length; i++) { + var expense = invoice.expenses[i]; + for (var i = 0; i < expense.documents.length; i++)addDoc(expense.documents[i]); + } } function addDoc(document){