Bug 707682: NPE while switching/closing tabs [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2011-12-06 14:51:08 -08:00
Родитель adf5e07ab9
Коммит c1cd92c8d2
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -176,10 +176,13 @@ public class TabsTray extends Activity implements GeckoApp.OnTabsChangedListener
return;
mWaitingForClose = true;
int tabId = Integer.parseInt(v.getTag().toString());
String tabId = v.getTag().toString();
Tabs tabs = Tabs.getInstance();
Tab tab = tabs.getTab(tabId);
Tab tab = tabs.getTab(Integer.parseInt(tabId));
if (tab == null)
return;
if (tabs.isSelectedTab(tab)) {
int index = tabs.getIndexOf(tab);
@ -189,9 +192,9 @@ public class TabsTray extends Activity implements GeckoApp.OnTabsChangedListener
index = 1;
int id = tabs.getTabAt(index).getId();
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Select", String.valueOf(id)));
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Close", v.getTag().toString()));
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Close", tabId));
} else {
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Close", v.getTag().toString()));
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Close", tabId));
GeckoAppShell.sendEventToGecko(new GeckoEvent("Tab:Select", String.valueOf(tabs.getSelectedTabId())));
}
}