Apply tizen 3.0 based product patchsets
[platform/core/connectivity/bluetooth-agent.git] / ag-agent / bluetooth-ag-manager.c
old mode 100755 (executable)
new mode 100644 (file)
index b5fbd28..5ba4477
@@ -528,6 +528,11 @@ static void __bt_hfp_handle_call_conference(void)
 
                struct telephony_call *t_call = t_call_list->data;
 
+               if (t_call == NULL) {
+                       ERR("t_call is NULL");
+                       break;
+               }
+
                if (t_call->call_status == HFP_CALL_STATUS_ACTIVE) {
                        if (t_active_call == NULL)
                                t_active_call = t_call;
@@ -554,10 +559,10 @@ static void __bt_hfp_handle_call_conference(void)
                }
        }
 
-       if (t_held_call_count == 1)
+       if (t_held_call != NULL && t_held_call_count == 1)
                t_held_call->call_conference = FALSE;
 
-       if (t_active_call_count == 1)
+       if (t_active_call != NULL && t_active_call_count == 1)
                t_active_call->call_conference = FALSE;
 }
 
@@ -697,9 +702,8 @@ static void __bt_hfp_set_call_status(struct telephony_call *t_call,
                        __bt_hfp_modify_indicator("call",
                                        INDICATOR_EVENT_CALL_INACTIVE);
 
-               if (org_status == HFP_CALL_STATUS_HOLD) {
+               if (org_status == HFP_CALL_STATUS_HOLD)
                        __bt_hfp_modify_indicator("callheld", INDICATOR_EVENT_CALLHELD_NONE);
-               }
 
                if ((org_status == HFP_CALL_STATUS_MO_ALERTING) ||
                        (org_status == HFP_CALL_STATUS_COMING) ||
@@ -1222,11 +1226,11 @@ void _bt_hfp_terminate_call_request(void *t_device)
        } else if ((t_alert = __bt_hfp_get_call_with_status(
                                HFP_CALL_STATUS_CREATE))
                != NULL) {
-               t_error = __bt_bt_hfp_reject_call(t_alert);
+               t_error = __bt_hfp_release_call(t_alert);
        } else if ((t_alert = __bt_hfp_get_call_with_status(
                                HFP_CALL_STATUS_MO_ALERTING))
                != NULL) {
-               t_error = __bt_bt_hfp_reject_call(t_alert);
+               t_error = __bt_hfp_release_call(t_alert);
        } else if       ((t_alert =  __bt_hfp_get_call_with_status(
                        HFP_CALL_STATUS_COMING)) != NULL) {
                t_error = __bt_bt_hfp_reject_call(t_alert);
@@ -1286,9 +1290,8 @@ void _bt_hfp_call_hold_request(const char *t_cmd, void *t_device)
 
        if (ret == TRUE)
                _bt_call_hold_response(t_device, HFP_STATE_MNGR_ERR_NONE);
-       else {
+       else
                _bt_call_hold_response(t_device, HFP_STATE_MNGR_ERR_AG_FAILURE);
-       }
 }
 
 void _bt_hfp_key_press_request(const char *t_key_press, void *t_device)