From 7f97011b550e56e7acb28462b67ac6a35991d135 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 15 Oct 2009 15:29:08 -0400 Subject: [PATCH] check for native initialization before calling public function Added more checks where it is possible to call a native function after creating a WebView but before the native side is initialized. These cases can be triggered by the monkey. Fixes http://b/issue?id=2187719 --- core/java/android/webkit/WebView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 916d21e81a835..9798c017d4cf4 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1721,6 +1721,7 @@ public class WebView extends AbsoluteLayout * as the data member with "url" as key. The result can be null. */ public void requestImageRef(Message msg) { + if (0 == mNativeClass) return; // client isn't initialized int contentX = viewToContentX((int) mLastTouchX + mScrollX); int contentY = viewToContentY((int) mLastTouchY + mScrollY); String ref = nativeImageURI(contentX, contentY); @@ -2339,6 +2340,7 @@ public class WebView extends AbsoluteLayout * @param forward Direction to search. */ public void findNext(boolean forward) { + if (0 == mNativeClass) return; // client isn't initialized nativeFindNext(forward); } @@ -2349,6 +2351,7 @@ public class WebView extends AbsoluteLayout * that were found. */ public int findAll(String find) { + if (0 == mNativeClass) return 0; // client isn't initialized if (mFindIsUp == false) { recordNewContentSize(mContentWidth, mContentHeight + mFindHeight, false); @@ -3477,6 +3480,7 @@ public class WebView extends AbsoluteLayout * @hide */ public void emulateShiftHeld() { + if (0 == mNativeClass) return; // client isn't initialized mExtendSelection = false; mShiftIsPressed = true; nativeHideCursor();