处理没有 callbackContext 时应用崩溃的问题。

This commit is contained in:
2021-09-24 14:57:27 +08:00
parent 8de1f4970c
commit b0a1591b0f

View File

@@ -29,6 +29,9 @@ public class RedLightScan extends CordovaPlugin {
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (callbackContext == null) {
return;
}
byte[] data = intent.getByteArrayExtra("data");
if (data != null) {
String barcode = new String(data);