From 3423f1edc1e263cb084f40bf64b74ae8b3979dbd Mon Sep 17 00:00:00 2001 From: "sgurun@chromium.org" Date: Wed, 2 Oct 2013 00:24:31 +0000 Subject: Early out if contentviewcore native side is null. BUG=b/10911057 Early out before calling native getNavigatonHistory as it may be deleted before. Review URL: https://codereview.chromium.org/25505005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226361 0039d316-1c4b-4281-b951-d872f2087c98 --- .../org/chromium/content/browser/ContentViewCore.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'content') diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index a301563..4af9cc5 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java @@ -3014,15 +3014,20 @@ import java.util.Map; */ public NavigationHistory getNavigationHistory() { NavigationHistory history = new NavigationHistory(); - int currentIndex = nativeGetNavigationHistory(mNativeContentViewCore, history); - history.setCurrentEntryIndex(currentIndex); + if (mNativeContentViewCore != 0) { + int currentIndex = nativeGetNavigationHistory(mNativeContentViewCore, history); + history.setCurrentEntryIndex(currentIndex); + } return history; } @Override public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { NavigationHistory history = new NavigationHistory(); - nativeGetDirectedNavigationHistory(mNativeContentViewCore, history, isForward, itemLimit); + if (mNativeContentViewCore != 0) { + nativeGetDirectedNavigationHistory( + mNativeContentViewCore, history, isForward, itemLimit); + } return history; } @@ -3031,7 +3036,10 @@ import java.util.Map; * current entry. */ public String getOriginalUrlForActiveNavigationEntry() { - return nativeGetOriginalUrlForActiveNavigationEntry(mNativeContentViewCore); + if (mNativeContentViewCore != 0) { + return nativeGetOriginalUrlForActiveNavigationEntry(mNativeContentViewCore); + } + return ""; } /** -- cgit v1.1