diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 76f89e4b..fe2b46f6 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -2044,6 +2044,10 @@ ItemSet.prototype._onAddItem = function (event) { newItemData.end = snap ? snap(end, scale, step) : end; } } else { + newItemData = { + start: snap ? snap(start, scale, step) : start, + content: 'new item' + }; newItemData[this.itemsData._fieldId] = util.randomUUID(); // when default type is a range, add a default end date to the new item diff --git a/lib/util.js b/lib/util.js index cfbfbaf5..24e2641a 100644 --- a/lib/util.js +++ b/lib/util.js @@ -188,7 +188,7 @@ exports.selectiveExtend = function (props, a, b) { for (var p = 0; p < props.length; p++) { var prop = props[p]; - if (other.hasOwnProperty(prop)) { + if (other && other.hasOwnProperty(prop)) { a[prop] = other[prop]; } }