diff options
| author | Steven Ng <stevenckng@google.com> | 2021-03-23 23:35:41 +0000 |
|---|---|---|
| committer | Steven Ng <stevenckng@google.com> | 2021-04-06 09:10:23 +0000 |
| commit | 32a1305cbd62222e13df51b1b4aa5ea488c65ffb (patch) | |
| tree | 68f264967dd14a20d49ab846883a5cecc9bef478 /core/java/android/view/View.java | |
| parent | 375467b87a4ca7982f2c7c733fcbaa02481486aa (diff) | |
onDrawScrollIndicators returns early if the view isn't attached
Test: Install a test app that can reproduce the null pointer
exception. Flash and install a build with this CL. Null
pointer exception can no longer be observed.
Bug: 183386115
Change-Id: Iab155dfca20e0119cc401d111ace23e416e93b93
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1e2b2aedfc08..dd5c95404510 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -19782,6 +19782,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return; } + if (mAttachInfo == null) { + // View is not attached. + return; + } + final int h = dr.getIntrinsicHeight(); final int w = dr.getIntrinsicWidth(); final Rect rect = mAttachInfo.mTmpInvalRect; |
