From 42348db3b8eb7dceca168bdd877747880f126598 Mon Sep 17 00:00:00 2001 From: pkt-dev <48358490+pkt-dev@users.noreply.github.com> Date: Fri, 18 Dec 2020 09:55:37 -0600 Subject: [PATCH] Update SystemSetting.java Catch unregister errors. `locationModeBR`, not `locationBR` for setting = null --- .../ninty/system/setting/SystemSetting.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/ninty/system/setting/SystemSetting.java b/android/src/main/java/com/ninty/system/setting/SystemSetting.java index dedd524..8c76d95 100644 --- a/android/src/main/java/com/ninty/system/setting/SystemSetting.java +++ b/android/src/main/java/com/ninty/system/setting/SystemSetting.java @@ -543,23 +543,33 @@ public void onHostPause() { @Override public void onHostDestroy() { if (wifiBR != null) { - mContext.unregisterReceiver(wifiBR); + try { + mContext.unregisterReceiver(wifiBR); + } catch (RuntimeException e) {} wifiBR = null; } if (bluetoothBR != null) { - mContext.unregisterReceiver(bluetoothBR); + try { + mContext.unregisterReceiver(bluetoothBR); + } catch (RuntimeException e) {} bluetoothBR = null; } if (locationBR != null) { - mContext.unregisterReceiver(locationBR); + try { + mContext.unregisterReceiver(locationBR); + } catch (RuntimeException e) {} locationBR = null; } if (locationModeBR != null) { - mContext.unregisterReceiver(locationModeBR); - locationBR = null; + try { + mContext.unregisterReceiver(locationModeBR); + } catch (RuntimeException e) {} + locationModeBR = null; } if (airplaneBR != null) { - mContext.unregisterReceiver(airplaneBR); + try { + mContext.unregisterReceiver(airplaneBR); + } catch (RuntimeException e) {} airplaneBR = null; } }