From 0b962d18efae8747d2d6eb09b0ced3c2cd910322 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Fri, 21 Aug 2020 19:14:40 -0400 Subject: [PATCH] When stopping an onion, dont even try if --local-only --- onionshare/onion.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/onionshare/onion.py b/onionshare/onion.py index 88d72496..23286635 100644 --- a/onionshare/onion.py +++ b/onionshare/onion.py @@ -665,15 +665,16 @@ class Onion(object): Stop a specific onion service """ onion_host = mode_settings.get("general", "service_id") - self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}") - try: - self.c.remove_ephemeral_hidden_service( - mode_settings.get("general", "service_id") - ) - except: - self.common.log( - "Onion", "stop_onion_service", f"failed to remove {onion_host}" - ) + if onion_host: + self.common.log("Onion", "stop_onion_service", f"onion host: {onion_host}") + try: + self.c.remove_ephemeral_hidden_service( + mode_settings.get("general", "service_id") + ) + except: + self.common.log( + "Onion", "stop_onion_service", f"failed to remove {onion_host}" + ) def cleanup(self, stop_tor=True): """