[tor-commits] [orbot/master] fixes #2848 newnym might call a null conn in service

n8fr8 at torproject.org n8fr8 at torproject.org
Fri Jan 10 03:01:52 UTC 2014


commit cf5e4454eb01c2bce055dd95c11314ad44141568
Author: Nathan Freitas <nathan at freitas.net>
Date:   Thu Jan 9 15:29:51 2014 -0500

    fixes #2848 newnym might call a null conn in service
---
 src/org/torproject/android/service/TorService.java |   23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 1167d4e..4413bd8 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -1387,17 +1387,20 @@ public class TorService extends Service implements TorServiceConstants, TorConst
         
         public void newIdentity () 
         {
-        
-        	new Thread ()
+        	//it is possible to not have a connection yet, and someone might try to newnym
+        	if (conn != null)
         	{
-        		public void run ()
-        		{
-        			try { conn.signal("NEWNYM"); }
-        			catch (IOException ioe){
-        				logMessage("error requesting newny: " + ioe.getLocalizedMessage());
-        			}
-        		}
-        	}.start();
+	        	new Thread ()
+	        	{
+	        		public void run ()
+	        		{
+	        			try { conn.signal("NEWNYM"); }
+	        			catch (IOException ioe){
+	        				logMessage("error requesting newny: " + ioe.getLocalizedMessage());
+	        			}
+	        		}
+	        	}.start();
+        	}
         }
         
 	    public boolean saveConfiguration ()





More information about the tor-commits mailing list