Bug 766865 - java.lang.IndexOutOfBoundsException in TabsTray.addTab [r=margaret a=akeybl]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 21 Jun 2012 14:18:58 -0700
changeset 98294 963b293cd4a61c6d77af51cfbc3237479b2cc23f
parent 98293 c557dd6b817c1c5eb9e91420a1f70605f5e5f24d
child 98295 29cbcad481dd4872b6b80f18f1d5c73ba339f8f3
push id1606
push usermbrubeck@mozilla.com
push dateThu, 28 Jun 2012 22:36:14 +0000
treeherdermozilla-aurora@963b293cd4a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, akeybl
bugs766865
milestone15.0a2
Bug 766865 - java.lang.IndexOutOfBoundsException in TabsTray.addTab [r=margaret a=akeybl]
mobile/android/base/TabsTray.java
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -129,16 +129,20 @@ public class TabsTray extends LinearLayo
                 return;
 
             mList.setSelection(selected);
             return;
         }
 
         int index = Tabs.getInstance().getIndexOf(tab);
         if (msg == Tabs.TabEvents.ADDED) {
+            if (index == -1) // If the tab has already been removed, do nothing.
+                return;
+            if (index > mTabsAdapter.getCount())
+                index = mTabsAdapter.getCount();
             mTabsAdapter.addTab(index, tab);
             mTabsAdapter.notifyDataSetChanged();
             return;
         }
 
         int position = mTabsAdapter.getPositionForTab(tab);
         if (position == -1)
             return;