diff --git a/src/classic/hfp.c b/src/classic/hfp.c index 900ff6753..0c47dc084 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -604,11 +604,7 @@ static void hfp_reset_voice_recognition(hfp_connection_t * hfp_connection){ } void hfp_reset_context_flags(hfp_connection_t * hfp_connection){ - if (!hfp_connection) return; - hfp_connection->ok_pending = 0; - hfp_connection->command = HFP_CMD_NONE; - - hfp_connection->change_status_update_for_individual_ag_indicators = 0; + hfp_connection->change_status_update_for_individual_ag_indicators = 0; hfp_connection->enable_extended_audio_gateway_error_report = 0; hfp_connection->extended_audio_gateway_error = 0; @@ -637,6 +633,9 @@ static hfp_connection_t * create_hfp_connection_context(void){ hfp_connection->acl_handle = HCI_CON_HANDLE_INVALID; hfp_connection->sco_handle = HCI_CON_HANDLE_INVALID; + hfp_connection->ok_pending = 0; + hfp_connection->command = HFP_CMD_NONE; + // parser hfp_connection->found_equal_sign = false; diff --git a/src/classic/hfp_hf.c b/src/classic/hfp_hf.c index d4edcf777..6d8c1167d 100644 --- a/src/classic/hfp_hf.c +++ b/src/classic/hfp_hf.c @@ -1447,6 +1447,8 @@ static void hfp_hf_handle_rfcomm_command(hfp_connection_t * hfp_connection){ case HFP_CMD_AG_ACTIVATE_VOICE_RECOGNITION: break; case HFP_CMD_ERROR: + hfp_connection->ok_pending = 0; + hfp_connection->command = HFP_CMD_NONE; switch (hfp_connection->state){ case HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED: switch (hfp_connection->codecs_state){