From c7c9c5fb0ab6b3d4ea3078865670d6c1dfe2ecac Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 28 Jan 2019 18:49:58 +0300 Subject: [PATCH] feedTree: amend previous to check that nodes are actually there (2) --- js/FeedTree.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/FeedTree.js b/js/FeedTree.js index 489aedaf0..f89486332 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -273,13 +273,15 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], setTimeout(() => { $("headlines-frame").focus(); - const node = treeNode.rowNode; - const tree = this.domNode; + if (treeNode) { + const node = treeNode.rowNode; + const tree = this.domNode; - if (node && tree) { - // scroll tree to selection if needed - if (node.offsetTop < tree.scrollTop || node.offsetTop > tree.scrollTop + tree.clientHeight) { - $("feedTree").scrollTop = node.offsetTop; + if (node && tree) { + // scroll tree to selection if needed + if (node.offsetTop < tree.scrollTop || node.offsetTop > tree.scrollTop + tree.clientHeight) { + $("feedTree").scrollTop = node.offsetTop; + } } }