(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
pull/115/head
Dmitry S 3 years ago
parent dc2aee4be9
commit 0dd4ad34f5

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

Loading…
Cancel
Save