Bug 766865 - java.lang.IndexOutOfBoundsException in TabsTray.addTab [r=margaret]

This commit is contained in:
Matt Brubeck 2012-06-21 14:18:58 -07:00
parent 1da57426b1
commit f5d637bb3f

View File

@ -134,6 +134,10 @@ public class TabsTray extends LinearLayout
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;