From 0dd4ad34f53ae5f5ecd095b87def6290810a6ecb Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Wed, 3 Nov 2021 19:54:46 -0400 Subject: [PATCH] (core) Avoid an error when pasting data with first row shorter than the rest Summary: Pasting data like `A\nB\tC` was failing because the first row, used for checking column type (to handle rich data), was failing on an undefined value. Discovered while trying out the fix in https://phab.getgrist.com/D3110. Test Plan: Tested manually. The case mentioned now works as expected. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3111 --- app/client/components/BaseView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/components/BaseView.js b/app/client/components/BaseView.js index 2874540c..ae5d73f0 100644 --- a/app/client/components/BaseView.js +++ b/app/client/components/BaseView.js @@ -373,7 +373,7 @@ BaseView.prototype._parsePasteForView = function(data, fields) { if (!col.length) { return col; } - const typeMatches = col[0].colType === updateColTypes[idx]; + const typeMatches = col[0] && col[0].colType === updateColTypes[idx]; const parser = parsers[idx]; return col.map(v => { if (v) {