From 82d3a23998dcaf5586f60272fc3fbc276d568ca2 Mon Sep 17 00:00:00 2001 From: Jamorham Date: Wed, 2 Nov 2016 16:10:21 +0000 Subject: [PATCH] DexShareCollectionService invalid address catch --- .../Services/DexShareCollectionService.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/Services/DexShareCollectionService.java b/app/src/main/java/com/eveningoutpost/dexdrip/Services/DexShareCollectionService.java index 533f3076ae..dd6bcef7f4 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/Services/DexShareCollectionService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/Services/DexShareCollectionService.java @@ -255,13 +255,19 @@ public void attemptConnection() { mDeviceName = btDevice.name; mDeviceAddress = btDevice.address; mBluetoothAdapter = mBluetoothManager.getAdapter(); - if (mBluetoothAdapter.isEnabled() && mBluetoothAdapter.getRemoteDevice(mDeviceAddress) != null) { - connect(mDeviceAddress); - return; - } else { - Log.w(TAG, "Bluetooth is disabled or BT device cant be found"); - setRetryTimer(); - return; + try { + if (mBluetoothAdapter.isEnabled() && mBluetoothAdapter.getRemoteDevice(mDeviceAddress) != null) { + connect(mDeviceAddress); + return; + } else { + Log.w(TAG, "Bluetooth is disabled or BT device cant be found"); + setRetryTimer(); + return; + } + } catch (IllegalArgumentException e) { + if (JoH.ratelimit("dex-share-error-log", 180)) { + Log.wtf(TAG, "Error connecting: " + e); + } } } else { Log.w(TAG, "No bluetooth device to try and connect to");