[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] conn may be null, but service may be bound, so make sure it is unbound here



commit da4162833e049c26ebb54468610d1508b398e529
Author: n8fr8 <nathan@xxxxxxxxxxxxxxxxxxxx>
Date:   Tue Dec 21 12:46:37 2021 -0500

    conn may be null, but service may be bound, so make sure it is unbound here
---
 .../main/java/org/torproject/android/service/OrbotService.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 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 5fd05409..491fe1fa 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
@@ -409,6 +409,11 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
      */
     private void stopTor() throws Exception {
 
+        if (shouldUnbindTorService) {
+            unbindService(torServiceConnection);
+            shouldUnbindTorService = false;
+        }
+
         if (conn != null) {
             logNotice("Using control port to shutdown Tor");
 
@@ -420,11 +425,6 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
                 Log.d(OrbotConstants.TAG, "error shutting down Tor via connection", e);
             }
 
-            if (shouldUnbindTorService) {
-                unbindService(torServiceConnection);
-                shouldUnbindTorService = false;
-            }
-
             conn = null;
         } else {
             stopSelf();



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