Make sure mParent is not null before using it
Otherwise, there will be NullPointerException. Fix: 204883084 Test: Run the following code and see if it crashes. ViewGroup v = new FrameLayout(context); v.requestTransparentRegion(v); getWindowManager().addView(v, attrs); getWindowManager().removeView(v); Change-Id: I059e13d2a258cf85dbc1694fb79b6088199de3fb
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user