From c8cae086f23bd8f3d740befcdbbda9a8688cc2a3 Mon Sep 17 00:00:00 2001 From: Leon Scroggins Date: Wed, 3 Nov 2010 18:51:46 -0400 Subject: Allow context menu items to be handled properly. Bug:3130048 BrowserBookmarksPage was claiming that it handled the MenuItem, so nothing was happening. BrowserHistoryPage assumed that the MenuInfo would always be non- null, and could cause a crash. Change-Id: Iaffbf88390f2513dc6ddb35a91ae097e873d5ae2 --- src/com/android/browser/BrowserBookmarksPage.java | 4 ++-- src/com/android/browser/BrowserHistoryPage.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/com/android/browser') diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index 4a3ae1f4f..88927bd3e 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -242,13 +242,13 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte // It is possible that the view has been canceled when we get to // this point as back has a higher priority if (mCanceled) { - return true; + return false; } AdapterView.AdapterContextMenuInfo i = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); // If we have no menu info, we can't tell which item was selected. if (i == null) { - return true; + return false; } switch (item.getItemId()) { diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index 9a57946c6..3b0292dea 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -276,6 +276,9 @@ public class BrowserHistoryPage extends Fragment public boolean onContextItemSelected(MenuItem item) { ExpandableListContextMenuInfo i = (ExpandableListContextMenuInfo) item.getMenuInfo(); + if (i == null) { + return false; + } HistoryItem historyItem = (HistoryItem) i.targetView; String url = historyItem.getUrl(); String title = historyItem.getName(); -- cgit v1.2.3