Bug 704467 - Crash in mozalloc_abort | __swrite | dexDataMapAlloc. Protect against a bad class cast. r=wesj

This commit is contained in:
Doug Turner 2012-01-12 09:59:59 -08:00
parent fa6a0c2cb8
commit fa1ccb4066

View File

@ -399,6 +399,10 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
String title = "";
if (view == (ListView)findViewById(R.id.history_list)) {
if (! (menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
Log.e(LOGTAG, "menuInfo is not ExpandableListContextMenuInfo");
return;
}
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
ExpandableListView exList = (ExpandableListView)list;
int childPosition = exList.getPackedPositionChild(info.packedPosition);
@ -408,9 +412,12 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
Map map = (Map)selectedItem;
title = (String)map.get(URLColumns.TITLE);
} else {
if (! (menuInfo instanceof AdapterView.AdapterContextMenuInfo)) {
Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo");
return;
}
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
selectedItem = list.getItemAtPosition(info.position);
Cursor cursor = (Cursor)selectedItem;
title = cursor.getString(cursor.getColumnIndexOrThrow(URLColumns.TITLE));
}