(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
This commit is contained in:
Dmitry S 2021-11-03 19:54:46 -04:00
parent dc2aee4be9
commit 0dd4ad34f5

View File

@ -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) {