Bug 766865 - java.lang.IndexOutOfBoundsException in TabsTray.addTab [r=margaret]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 21 Jun 2012 14:18:58 -0700
changeset 97327 039721acef4709e4608c4bf4724563dd4a79525f
parent 97326 685105c235d74a2653f128ebdf1d4e02890915af
child 97328 bd0284bc1b63aafaaae273e56d3168bc73d944b7
push id10986
push usermbrubeck@mozilla.com
push dateThu, 21 Jun 2012 21:19:31 +0000
treeherdermozilla-inbound@039721acef47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs766865
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 766865 - java.lang.IndexOutOfBoundsException in TabsTray.addTab [r=margaret]
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;