From 674007d892110d813664554ae8875f21245dbd7e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 2 Jun 2019 15:15:14 +0200 Subject: [PATCH] don't fail when insert first or appending a tile --- src/domain/session/room/timeline/TilesCollection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/timeline/TilesCollection.js b/src/domain/session/room/timeline/TilesCollection.js index 0b1dab8e..4726fdde 100644 --- a/src/domain/session/room/timeline/TilesCollection.js +++ b/src/domain/session/room/timeline/TilesCollection.js @@ -88,8 +88,8 @@ export default class TilesCollection extends BaseObservableList { const newTile = this._tileCreator(entry); if (newTile) { - prevTile.updateNextSibling(newTile); - nextTile.updatePreviousSibling(newTile); + prevTile && prevTile.updateNextSibling(newTile); + nextTile && nextTile.updatePreviousSibling(newTile); this._tiles.splice(tileIdx, 0, newTile); this.emitAdd(tileIdx, newTile); }