From c8423340039ff650dfd6af32d56b109657aed34a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 6 May 2020 23:48:19 +0530 Subject: [PATCH] fix: Handle null table --- model/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/document.js b/model/document.js index 5bd4c1fc..237c1c54 100644 --- a/model/document.js +++ b/model/document.js @@ -636,7 +636,7 @@ module.exports = class BaseDocument extends Observable { // helper functions getSum(tablefield, childfield) { - return this[tablefield] + return (this[tablefield] || []) .map(d => parseFloat(d[childfield], 10) || 0) .reduce((a, b) => a + b, 0); }