Add null check in nfa_ce_deactivate_ntf

Bug: 120846143
Test: send RF command sequence manually
Merged-In: I71a933efa2c81c5f73d56af6d712c7d72b6f2fac
Change-Id: I71a933efa2c81c5f73d56af6d712c7d72b6f2fac
diff --git a/src/nfa/ce/nfa_ce_act.c b/src/nfa/ce/nfa_ce_act.c
index 38a0576..58a19d1 100644
--- a/src/nfa/ce/nfa_ce_act.c
+++ b/src/nfa/ce/nfa_ce_act.c
@@ -21,6 +21,7 @@
  *  This file contains the action functions the NFA_CE state machine.
  *
  ******************************************************************************/
+#include <log/log.h>
 #include <string.h>
 #include "ce_api.h"
 #include "ndef_utils.h"
@@ -954,7 +955,8 @@
       if ((p_cb->listen_info[i].flags & NFA_CE_LISTEN_INFO_UICC) &&
           (i == p_cb->idx_cur_active)) {
         conn_evt.deactivated.type = deact_type;
-        (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
+        if (p_cb->p_active_conn_cback)
+          (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
       } else if ((p_cb->activation_params.protocol == NFA_PROTOCOL_ISO_DEP) &&
                  (p_cb->listen_info[i].protocol_mask &
                   NFA_PROTOCOL_MASK_ISO_DEP)) {
@@ -963,24 +965,31 @@
               NFA_CE_LISTEN_INFO_T4T_ACTIVATE_PND)) {
           if (i == NFA_CE_LISTEN_INFO_IDX_NDEF) {
             conn_evt.deactivated.type = deact_type;
-            (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
+            if (p_cb->p_active_conn_cback)
+              (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
           } else {
             conn_evt.ce_deactivated.handle =
                 NFA_HANDLE_GROUP_CE | ((tNFA_HANDLE)i);
             conn_evt.ce_deactivated.type = deact_type;
-            (*p_cb->p_active_conn_cback)(NFA_CE_DEACTIVATED_EVT, &conn_evt);
+            if (p_cb->p_active_conn_cback)
+              (*p_cb->p_active_conn_cback)(NFA_CE_DEACTIVATED_EVT, &conn_evt);
           }
         }
       } else if ((p_cb->activation_params.protocol == NFA_PROTOCOL_T3T) &&
                  (p_cb->listen_info[i].protocol_mask & NFA_PROTOCOL_MASK_T3T)) {
         if (i == NFA_CE_LISTEN_INFO_IDX_NDEF) {
           conn_evt.deactivated.type = deact_type;
-          (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
+          if (p_cb->p_active_conn_cback)
+            (*p_cb->p_active_conn_cback)(NFA_DEACTIVATED_EVT, &conn_evt);
         } else {
           conn_evt.ce_deactivated.handle =
               NFA_HANDLE_GROUP_CE | ((tNFA_HANDLE)i);
           conn_evt.ce_deactivated.type = deact_type;
-          (*p_cb->p_active_conn_cback)(NFA_CE_DEACTIVATED_EVT, &conn_evt);
+          if (p_cb->p_active_conn_cback) {
+            (*p_cb->p_active_conn_cback)(NFA_CE_DEACTIVATED_EVT, &conn_evt);
+          } else {
+            android_errorWriteLog(0x534e4554, "120846143");
+          }
         }
       }
     }