From c22e03c2d2d859e458708875ace29880445a7e9c Mon Sep 17 00:00:00 2001 From: Mesbah Date: Tue, 26 Oct 2021 15:44:54 -0700 Subject: [PATCH] Prevent NPE on sendEvent --- src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java b/src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java index e8256d83..f2c15ce9 100644 --- a/src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java +++ b/src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java @@ -737,7 +737,7 @@ private void sendEvent(String type, JSONObject tag) { PluginResult result = new PluginResult(PluginResult.Status.OK, event); result.setKeepCallback(true); - channelCallback.sendPluginResult(result); + if (channelCallback != null) channelCallback.sendPluginResult(result); } catch (JSONException e) { Log.e(TAG, "Error sending NFC event through the channel", e); }