From 4fb170491287b9d4b750d9de40ccf31f5f76e136 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 17 Jan 2022 09:21:14 +0100 Subject: [PATCH] Ignore exception without permission --- .../plugins/general/maintenance/ImportExportPrefsImpl.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt index 10d062aef2..397f71248a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt @@ -110,7 +110,11 @@ class ImportExportPrefsImpl @Inject constructor( // based on https://medium.com/@pribble88/how-to-get-an-android-device-nickname-4b4700b3068c val n1 = Settings.System.getString(context.contentResolver, "bluetooth_name") val n2 = Settings.Secure.getString(context.contentResolver, "bluetooth_name") - val n3 = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name + val n3 = try { + (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name + } catch (e: Exception){ + null + } val n4 = Settings.System.getString(context.contentResolver, "device_name") val n5 = Settings.Secure.getString(context.contentResolver, "lock_screen_owner_info") val n6 = Settings.Global.getString(context.contentResolver, "device_name")