[3.4.0][Crash] 修正空指针

This commit is contained in:
renwj
2023-07-18 15:16:26 +08:00
parent d154b64ca7
commit 8ee4c90d41

View File

@@ -63,6 +63,9 @@ public class WindowCallbackLancet {
@TargetMethod(methodName = "addView")
@ReplaceInvoke
public static void proxyWindowManagerAddView(WindowManager manager, View view, ViewGroup.LayoutParams params) {
if (view == null) {
return;
}
view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
private final GlobalFocusChangedListener listener = new GlobalFocusChangedListener();
private boolean isAdd = false;
@@ -93,6 +96,9 @@ public class WindowCallbackLancet {
@TargetMethod(methodName = "setContentView")
@ReplaceInvoke
public static void proxyPopupWindowSetContentView(PopupWindow window, View view) {
if (view == null) {
return;
}
view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
private final GlobalFocusChangedListener listener = new GlobalFocusChangedListener();
private boolean isAdd = false;