commit 1682f7cb89a05e6c4d2e3d197aed55a7745ff717
Author: n8fr8 <nat...@guardianproject.info>
Date:   Fri Dec 17 18:14:49 2021 -0500

    if someone stops during starting, conn could be null
---
 .../org/torproject/android/service/OrbotService.java  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git 
a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java 
b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
index 7acc4073..49e3240a 100644
--- 
a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
+++ 
b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
@@ -819,17 +819,20 @@ public class OrbotService extends VpnService implements 
TorServiceConstants, Orb
                     events.add(TorControlCommands.EVENT_DEBUG_MSG);
                     events.add(TorControlCommands.EVENT_INFO_MSG);
                 }
-                try {
-                    conn.setEventHandler(mEventHandler);
-                    conn.setEvents(events);
-                    logNotice("SUCCESS added control port event handler");
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
+
+                if (conn != null) {
+                    try {
+                        conn.setEventHandler(mEventHandler);
+                        conn.setEvents(events);
+                        logNotice("SUCCESS added control port event handler");
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
 
 
-                initControlConnection();
+                    initControlConnection();
                     showConnectedToTorNetworkNotification();
+                }
 
             }
 



_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to