fix crash when calling linphone_call_get_remote_params() when no incoming message is received yet.

This commit is contained in:
Simon Morlat 2015-10-14 14:21:41 +02:00
parent 49a80e87f3
commit 28e6ee40b2
2 changed files with 12 additions and 4 deletions

View file

@ -1783,8 +1783,8 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
if (call->op){
LinphoneCallParams *cp;
SalMediaDescription *md;
const SalCustomHeader *ch;
md=sal_call_get_remote_media_description(call->op);
if (md) {
SalStreamDescription *sd;
unsigned int i;
@ -1820,7 +1820,12 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
linphone_call_params_set_custom_sdp_media_attributes(call->remote_params, LinphoneStreamTypeVideo, md->streams[call->main_video_stream_index].custom_sdp_attributes);
linphone_call_params_set_custom_sdp_media_attributes(call->remote_params, LinphoneStreamTypeText, md->streams[call->main_text_stream_index].custom_sdp_attributes);
}
linphone_call_params_set_custom_headers(call->remote_params, sal_op_get_recv_custom_header(call->op));
ch = sal_op_get_recv_custom_header(call->op);
if (ch){
/*instanciate a remote_params only if a SIP message was received before (custom headers indicates this).*/
if (call->remote_params == NULL) call->remote_params = linphone_call_params_new();
linphone_call_params_set_custom_headers(call->remote_params, ch);
}
return call->remote_params;
}
return NULL;

View file

@ -214,15 +214,18 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr
LinphoneCallParams *callee_params = callee_test_params->base;
bool_t did_receive_call;
LinphoneCall *callee_call=NULL;
LinphoneCall *caller_call=NULL;
setup_sdp_handling(caller_test_params, caller_mgr);
setup_sdp_handling(callee_test_params, callee_mgr);
if (!caller_params){
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity));
BC_ASSERT_PTR_NOT_NULL((caller_call=linphone_core_invite_address(caller_mgr->lc,callee_mgr->identity)));
}else{
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params));
BC_ASSERT_PTR_NOT_NULL((caller_call=linphone_core_invite_address_with_params(caller_mgr->lc,callee_mgr->identity,caller_params)));
}
BC_ASSERT_PTR_NULL(linphone_call_get_remote_params(caller_call)); /*assert that remote params are NULL when no response is received yet*/
did_receive_call = wait_for(callee_mgr->lc
,caller_mgr->lc