changeset b2bf035c681a in sao:4.8
details: https://hg.tryton.org/sao?cmd=changeset;node=b2bf035c681a
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
        (grafted from cf315f485159690eb0e276f76008911152ae8588)
diffstat:

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

diffs (15 lines):

diff -r 6a77d9f066a6 -r b2bf035c681a src/tab.js
--- a/src/tab.js        Mon Jul 08 18:51:36 2019 +0200
+++ b/src/tab.js        Mon Jul 08 18:49:22 2019 +0200
@@ -274,7 +274,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) {
                     next.find('a').tab('show');
                 }

Reply via email to