diff --git a/embedding/android/GeckoApp.java b/embedding/android/GeckoApp.java index 601f2f0eff45..1e49c537c624 100644 --- a/embedding/android/GeckoApp.java +++ b/embedding/android/GeckoApp.java @@ -372,9 +372,11 @@ abstract public class GeckoApp case R.id.bookmarks: Intent intent = new Intent(this, GeckoBookmarks.class); SessionHistory.HistoryEntry he = getSessionHistory().getHistoryEntryAt(0); - intent.setData(android.net.Uri.parse(he.mUri)); - intent.putExtra("title", he.mTitle); - startActivity(intent); + if (he != null) { + intent.setData(android.net.Uri.parse(he.mUri)); + intent.putExtra("title", he.mTitle); + startActivity(intent); + } return true; default: return super.onOptionsItemSelected(item); diff --git a/embedding/android/SessionHistory.java b/embedding/android/SessionHistory.java index 9e7085986813..65c7168c0505 100644 --- a/embedding/android/SessionHistory.java +++ b/embedding/android/SessionHistory.java @@ -122,6 +122,8 @@ class SessionHistory } } HistoryEntry getHistoryEntryAt(int index) { - return mHistory.get(index); + if (index < mHistory.size()) + return mHistory.get(index); + return null; } }