Merge "Make sure mParent is not null before using it" into sc-v2-dev

This commit is contained in:
Tiger Huang
2021-11-05 14:41:54 +00:00
committed by Android (Google) Code Review

View File

@@ -20270,7 +20270,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
@CallSuper
protected void onAttachedToWindow() {
if ((mPrivateFlags & PFLAG_REQUEST_TRANSPARENT_REGIONS) != 0) {
if (mParent != null && (mPrivateFlags & PFLAG_REQUEST_TRANSPARENT_REGIONS) != 0) {
mParent.requestTransparentRegion(this);
}
@@ -25044,7 +25044,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
View parent = this;
while (parent.mParent != null && parent.mParent instanceof View) {
while (parent.mParent instanceof View) {
parent = (View) parent.mParent;
}