From 3a9b6c2a85407e480ceb8cfa0461dfd10a510aeb Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Wed, 20 May 2020 10:31:14 +0800 Subject: [PATCH] android:add protection for DoricPanel is null --- .../doric/src/main/java/pub/doric/DoricPanelFragment.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java b/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java index d0ae5a56..afacbd98 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricPanelFragment.java @@ -98,7 +98,7 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator { @Override public void onResume() { super.onResume(); - if (!(getActivity() instanceof LifecycleOwner)) { + if (!(getActivity() instanceof LifecycleOwner && doricPanel != null)) { doricPanel.onActivityResume(); } } @@ -106,7 +106,7 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator { @Override public void onPause() { super.onPause(); - if (!(getActivity() instanceof LifecycleOwner)) { + if (!(getActivity() instanceof LifecycleOwner) && doricPanel != null) { doricPanel.onActivityPause(); } } @@ -114,7 +114,8 @@ public class DoricPanelFragment extends Fragment implements IDoricNavigator { @Override public void onDestroy() { super.onDestroy(); - if (getActivity() == null || !getActivity().isFinishing() || !(getActivity() instanceof LifecycleOwner)) { + if ((getActivity() == null || !getActivity().isFinishing() || !(getActivity() instanceof LifecycleOwner)) + && doricPanel != null) { doricPanel.onActivityDestroy(); } }