From 8ac64396dc9ef50bf14718275efa930a9a4cf25a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 1 Sep 2017 17:49:56 +0200 Subject: [PATCH] Prevent test Call redirected by callee from crashing --- tester/call_single_tester.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index b10f01b2d..9d610103a 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -3427,7 +3427,7 @@ static void call_redirect(void){ LinphoneCoreManager* laure = linphone_core_manager_new("laure_rc_udp"); bctbx_list_t* lcs = NULL; char *laure_url = NULL; - LinphoneCall* marie_call; + LinphoneCall* marie_call, *laure_call; lcs = bctbx_list_append(lcs,marie->lc); lcs = bctbx_list_append(lcs,pauline->lc); @@ -3452,16 +3452,20 @@ static void call_redirect(void){ /* the call should still be ringing on marie's side */ BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingRinging, 1, int, "%i"); - linphone_call_accept(linphone_core_get_current_call(laure->lc)); + laure_call = linphone_core_get_current_call(laure->lc); + BC_ASSERT_PTR_NOT_NULL(laure_call); + if (laure_call) { + linphone_call_accept(laure_call); - BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,5000)); - BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallStreamsRunning, 1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallStreamsRunning, 1,5000)); - BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc)); - liblinphone_tester_check_rtcp(marie, laure); + liblinphone_tester_check_rtcp(marie, laure); - end_call(laure, marie); + end_call(laure, marie); + } } bctbx_list_free(lcs);