Fix crash after setting turn username and password.

This commit is contained in:
Simon Morlat 2017-12-28 17:34:55 +01:00
parent 5ceafb9590
commit bd12d899ea

View file

@ -808,14 +808,14 @@
if ([turn_username length] > 0) {
const LinphoneAuthInfo *turnAuthInfo = nil;
if ([turn_password length] > 0)
if ([turn_password length] > 0){
turnAuthInfo = linphone_auth_info_new([turn_username UTF8String], NULL,
[turn_password UTF8String], NULL, NULL, NULL);
else
turnAuthInfo = linphone_core_find_auth_info(LC, NULL, [turn_username UTF8String], NULL);
if (turnAuthInfo != NULL)
linphone_core_add_auth_info(LC, turnAuthInfo);
linphone_nat_policy_set_stun_server_username(LNP, linphone_auth_info_get_username(turnAuthInfo));
}else{
turnAuthInfo = linphone_core_find_auth_info(LC, NULL, [turn_username UTF8String], NULL);
}
linphone_nat_policy_set_stun_server_username(LNP, [turn_username UTF8String]);
}
} else {
linphone_nat_policy_enable_stun(LNP, FALSE);