diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-10-19 12:40:53 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-19 12:40:53 -0700 |
commit | 59993d9bc589089e6be55371c6536a42afe21a64 (patch) | |
tree | d3343a45eb969c92917792b7309d369009ea295d | |
parent | bdf1706ac680c0fe74765b8d6d34823b8ac05306 (diff) | |
parent | 44d2c69ad30878521c6eff66a83893099b3d12ee (diff) | |
download | frameworks_base-59993d9bc589089e6be55371c6536a42afe21a64.zip frameworks_base-59993d9bc589089e6be55371c6536a42afe21a64.tar.gz frameworks_base-59993d9bc589089e6be55371c6536a42afe21a64.tar.bz2 |
Merge "Avoid NPE in WebTextView.lineUpScroll -> Touch.getMaxScrollX" into gingerbread
-rw-r--r-- | core/java/android/webkit/WebTextView.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index f7afdb9..4f192b3 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -28,6 +28,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.Editable; import android.text.InputFilter; +import android.text.Layout; import android.text.Selection; import android.text.Spannable; import android.text.TextPaint; @@ -292,8 +293,9 @@ import java.util.ArrayList; * Ensure that the underlying textfield is lined up with the WebTextView. */ private void lineUpScroll() { - if (mWebView != null) { - float maxScrollX = Touch.getMaxScrollX(this, getLayout(), mScrollY); + Layout layout = getLayout(); + if (mWebView != null && layout != null) { + float maxScrollX = Touch.getMaxScrollX(this, layout, mScrollY); if (DebugFlags.WEB_TEXT_VIEW) { Log.v(LOGTAG, "onTouchEvent x=" + mScrollX + " y=" + mScrollY + " maxX=" + maxScrollX); |