From ef91313681ba7fdc0f2e67b581d2122a9ddc0820 Mon Sep 17 00:00:00 2001 From: wuxiang Date: Sun, 26 Sep 2021 15:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=20unregister=20=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/android/RedLightScan.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/android/RedLightScan.java b/src/android/RedLightScan.java index 05646a0..dffe554 100644 --- a/src/android/RedLightScan.java +++ b/src/android/RedLightScan.java @@ -91,7 +91,9 @@ public class RedLightScan extends CordovaPlugin { } private void unregisterReceiver() { - webView.getContext().unregisterReceiver(receiver); + if (receiver != null) { + webView.getContext().unregisterReceiver(receiver); + } } @Override