changeset c0e9704f5a50 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=c0e9704f5a50
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 fa7332db965e -r c0e9704f5a50 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
@@ -309,7 +309,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