From 5dc625a64cf58d798929f22c3073cd06b837f87a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 25 十一月 2021 16:44:57 +0800
Subject: [PATCH] 2021-11-25 1.更新

---
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
index 9a7bbbf..e84e103 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
@@ -175,12 +175,18 @@
     public void onDestroy() {
         removeAllCallback();
         logout();
-        mCore.removeListener(mCoreListener);
-        mTimer.cancel();
-        mCore.stop();
-        // A stopped Core can be started again
-        // To ensure resources are freed, we must ensure it will be garbage collected
-        mCore = null;
+
+        if(mTimer != null) {
+            mTimer.cancel();
+        }
+
+        if(mCore != null){
+            mCore.removeListener(mCoreListener);
+            mCore.stop();
+            // A stopped Core can be started again
+            // To ensure resources are freed, we must ensure it will be garbage collected
+            mCore = null;
+        }
         // Don't forget to free the singleton as well
         sInstance = null;
 

--
Gitblit v1.8.0