mqtt PAUSE() 函数 鲁棒性优化
authorsnickersun <scy@incartech.cn>
Wed, 2 Sep 2020 01:15:37 +0000 (09:15 +0800)
committersnickersun <scy@incartech.cn>
Wed, 2 Sep 2020 01:15:37 +0000 (09:15 +0800)
app/src/main/java/com/ic/protocols/protocol_mqtt_client.java

index fd57e10..85a1d75 100644 (file)
@@ -122,13 +122,13 @@ public class protocol_mqtt_client {
 \r
     public void Pause() {\r
         try {\r
-            mClient.disconnect();\r
+            if(mClient!=null) mClient.disconnect();\r
 \r
             mContext.unbindService(mConnection);\r
 \r
             isBinding = false;\r
             isBound = false;\r
-        } catch (IllegalArgumentException ex) {\r
+        } catch (Exception ex) {\r
             Log.e(TAG, "Couldn't unbind the service, this is probably fine considering the state changes in the app... can probably ignore this.", ex);\r
         }\r
 \r