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
This commit is contained in:
Steven Ng
2021-03-23 23:35:41 +00:00
parent 375467b87a
commit 32a1305cbd

View File

@@ -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;