From 3557de1de3968fe5fcd80acf92f12f0a37eff3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 8 Jul 2019 18:49:22 +0200 Subject: [PATCH] Ensure to remove only the tab from the list of tabs Tab.close can be called multiple times (ex: closing wizard running in a tab) so the indexOf can return -1 if the tab has already been removed. issue8431 review263691002 --- src/tab.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tab.js b/src/tab.js index 14808d61ca..c4cf24ae81 100644 --- a/src/tab.js +++ b/src/tab.js @@ -283,7 +283,10 @@ } tab.remove(); content.remove(); - Sao.Tab.tabs.splice(Sao.Tab.tabs.indexOf(this), 1); + var i = Sao.Tab.tabs.indexOf(this); + if (i >= 0) { + Sao.Tab.tabs.splice(i, 1); + } if (next.length) { next.find('a').tab('show'); } else {