changeset 4477997dc284 in sao:4.4
details: https://hg.tryton.org/sao?cmd=changeset;node=4477997dc284
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 556badb86238 -r 4477997dc284 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
@@ -162,7 +162,10 @@
                 }
                 tab.tooltip('destroy').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