From 5de151dc62caa499157224620ed05bfda5f6d612 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 18 May 2022 11:13:24 +0200 Subject: avoid possible NPE in ClientTransportPlugin --- .../main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java b/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java index 0b481780..59c1290a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/ClientTransportPlugin.java @@ -113,13 +113,16 @@ public class ClientTransportPlugin implements ClientTransportPluginInterface { @Override public void stop() { IPtProxy.stopSnowflake(); - try { + try { TorStatusObservable.waitUntil(this::isSnowflakeOff, 10); } catch (InterruptedException | TimeoutException e) { e.printStackTrace(); } snowflakePort = -1; - logFileObserver.stopWatching(); + if (logFileObserver != null) { + logFileObserver.stopWatching(); + logFileObserver = null; + } } private boolean isSnowflakeOff() { -- cgit v1.2.3