loleaflet/src/layer/AnnotationManager.js | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 05e6700004231530b87fdc5bc3a35a89b6a1c53c Author: Pranav Kant <pran...@collabora.co.uk> Date: Tue Apr 25 21:04:46 2017 +0530 loleaflet: Warn, and don't crash, if we don't get expected data It is possible that backend sends comment for which there is no parent comment sent yet, as presently is the case as I am writing this. Warn nicely in this case. Change-Id: I2609dfdcdac69380b824d444ba8f64803996286c diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 7fee34a6..cd55ae15 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -476,6 +476,11 @@ L.AnnotationManager = L.Class.extend({ adjustParentAdd: function(comment) { if (comment.parent && comment.parent > '0') { var parentIdx = this.getIndexOf(comment.parent); + if (parentIdx === -1) { + console.warn('adjustParentAdd: No parent comment to attach received comment to. ' + + 'Parent comment ID sought is :' + comment.parent + ' for current comment with ID : ' + comment.id); + return; + } if (this._items[parentIdx + 1] && this._items[parentIdx + 1]._data.parent === this._items[parentIdx]._data.id) { this._items[parentIdx + 1]._data.parent = comment.id; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits