From 8c526d4b8cb35640902c17454d5f6cd5a19d2c20 Mon Sep 17 00:00:00 2001 From: Daniel Dawson Date: Thu, 9 Jul 2020 09:25:38 -0700 Subject: [PATCH] Fix NullPointerException with external tor usage If torControlPort is specified, but neither torControlPassword nor torControlCookieFile are specified, we have cookieFile == null in bisq.network.p2p.network.RunningTor, but RunningTor.getTor() assumes a cookie file has been specified and tries to check that the file exists, causing the thread to crash. Added a check for null to fix this. --- p2p/src/main/java/bisq/network/p2p/network/RunningTor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java b/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java index e39be46a97d..79d638d8b71 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java +++ b/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java @@ -64,7 +64,7 @@ public Tor getTor() throws IOException, TorCtlException { Tor result; if (!password.isEmpty()) result = new ExternalTor(controlPort, password); - else if (cookieFile.exists()) + else if (cookieFile != null && cookieFile.exists()) result = new ExternalTor(controlPort, cookieFile, useSafeCookieAuthentication); else result = new ExternalTor(controlPort);