changeset cf315f485159 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=cf315f485159
description:
        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
diffstat:

 src/tab.js |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r f035bbe07409 -r cf315f485159 src/tab.js
--- a/src/tab.js        Mon Jul 08 17:15:51 2019 +0200
+++ b/src/tab.js        Mon Jul 08 18:49:22 2019 +0200
@@ -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 {

Reply via email to