commit a5b26df61b802840766a68984c1fe639ef44a032 Author: Hashik Donthineni HashikDonthineni@gmail.com Date: Sun Jun 28 14:42:57 2020 +0530
Fixed webscoket NullPointerException when there is no connection --- app/src/main/java/org/torproject/snowflake/MyPersistentService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java index c02276e..29fdad6 100644 --- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java +++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java @@ -123,8 +123,8 @@ public class MyPersistentService extends Service { mainPeerConnection.close(); mainPeerConnection.dispose(); } - - webSocket.close(1000, "Normal closure"); + if (webSocket != null) + webSocket.close(1000, "Normal closure"); mNotificationManager.cancel(ForegroundServiceConstants.DEF_NOTIFICATION_ID); Log.d(TAG, "onDestroy: Service Destroyed"); super.onDestroy();