From 572b59cc0c90313a02963766f878f12c86b3be23 Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Fri, 20 Aug 2021 03:31:19 -0400 Subject: [PATCH] (core) Fix JS error when pasting data with merged cells. Summary: Pasting data with merged cells from Excel (or from HTML tables with colspan/rowspan), we used to get "Cannot read property 'displayValue' of undefined". Fix it by assuming that some cell values may be empty. Test Plan: Added test case reproduces the failure without the fix, and passes with. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D2990 --- app/client/components/BaseView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/client/components/BaseView.js b/app/client/components/BaseView.js index 2e9050db..2e888d49 100644 --- a/app/client/components/BaseView.js +++ b/app/client/components/BaseView.js @@ -369,9 +369,9 @@ BaseView.prototype._parsePasteForView = function(data, cols) { _.isObject(data[0][0]) && data[0][0].hasOwnProperty('displayValue')) { richData = data.map((col, idx) => { if (col[0].colType === updateColTypes[idx]) { - return col.map(v => v.hasOwnProperty('rawValue') ? v.rawValue : v.displayValue); + return col.map(v => v && v.hasOwnProperty('rawValue') ? v.rawValue : v.displayValue); } else { - return col.map(v => v.displayValue); + return col.map(v => v && v.displayValue); } }); }