From e36d1c89548e5e93dd8df8eaac4ddab3341688f1 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Fri, 6 May 2016 09:21:27 +0100
Subject: [PATCH] Fixed possible NPE from uninitialised control connection.

---
 briar-android/src/org/briarproject/plugins/tor/TorPlugin.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java
index cd460d344b..a09af47243 100644
--- a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java
+++ b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java
@@ -217,13 +217,13 @@ class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
 			// Now we should be able to connect to the new process
 			controlSocket = new Socket("127.0.0.1", CONTROL_PORT);
 		}
-		running = true;
 		// Open a control connection and authenticate using the cookie file
 		controlConnection = new TorControlConnection(controlSocket);
 		controlConnection.authenticate(read(cookieFile));
 		// Tell Tor to exit when the control connection is closed
 		controlConnection.takeOwnership();
 		controlConnection.resetConf(Collections.singletonList(OWNER));
+		running = true;
 		// Register to receive events from the Tor process
 		controlConnection.setEventHandler(this);
 		controlConnection.setEvents(Arrays.asList(EVENTS));
-- 
GitLab