From d3c921c8b1a11955bbe8c947d03a7493d0913cc0 Mon Sep 17 00:00:00 2001 From: Jamorham Date: Wed, 5 Apr 2017 09:53:23 +0100 Subject: [PATCH] Multicast DNS: state exception fix --- .../main/java/com/eveningoutpost/dexdrip/utils/Mdns.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utils/Mdns.java b/app/src/main/java/com/eveningoutpost/dexdrip/utils/Mdns.java index c63416dcde..713ad3587f 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utils/Mdns.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utils/Mdns.java @@ -139,7 +139,11 @@ public void run() { } } UserError.Log.d(TAG, "Shutting down"); - mNsdManager.stopServiceDiscovery(mDiscoveryListener); + try { + mNsdManager.stopServiceDiscovery(mDiscoveryListener); + } catch (IllegalArgumentException | IllegalStateException e) { + UserError.Log.e(TAG, "Could not stop timed service discovery: " + e); + } hunt_running = false; JoH.releaseWakeLock(wl); } @@ -263,7 +267,7 @@ public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { try { mNsdManager.stopServiceDiscovery(mDiscoveryListener); } catch (Exception e) { - UserError.Log.d(TAG, "Failed top stop service discovery on failure: " + e); + UserError.Log.d(TAG, "Failed to stop service discovery on failure: " + e); } outstanding.decrementAndGet(); locked_until = 0;