From 3c5b5236313ea09433871a5dfaf98b9fca11a373 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 10 Mar 2021 10:10:46 +0100 Subject: [PATCH] ui: NavigationTree: do not modify list while iterating iterating over a nodeinterfaces children while removing them will lead to 'child' being undefined instead collect the children to remove in a separate list and iterate over them Signed-off-by: Dominik Csapak --- www/NavigationTree.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/NavigationTree.js b/www/NavigationTree.js index a9e97567..4bdfbc66 100644 --- a/www/NavigationTree.js +++ b/www/NavigationTree.js @@ -188,11 +188,13 @@ Ext.define('PBS.view.main.NavigationTree', { } } + let toremove = []; list.eachChild((child) => { if (!newSet[child.data.path]) { - list.removeChild(child, true); + toremove.push(child); } }); + toremove.forEach((child) => list.removeChild(child, true)); if (view.pathToSelect !== undefined) { let path = view.pathToSelect;