Commit 245d7ac6 authored by jehan's avatar jehan
Browse files

Fix crash in case of LinphoneChatRoomBackendFlexisipChat created prior to registration ok.

parent c80eeb4e
......@@ -71,7 +71,7 @@ static IdentityAddress getDefaultLocalAddress(const shared_ptr<Core> &core, cons
IdentityAddress localAddress;
if (proxy) {
char *identity = linphone_address_as_string(
withGruu ? linphone_proxy_config_get_contact(proxy) : linphone_proxy_config_get_identity_address(proxy));
(withGruu && linphone_proxy_config_get_contact(proxy))? linphone_proxy_config_get_contact(proxy) : linphone_proxy_config_get_identity_address(proxy));
localAddress = IdentityAddress(identity);
bctbx_free(identity);
} else
......@@ -116,7 +116,7 @@ shared_ptr<AbstractChatRoom> CorePrivate::createClientGroupChatRoom (
return nullptr;
}
if (!conferenceId.getLocalAddress().hasGruu()){
lError() << "createClientGroupChatRoom(): local address must have a gruu.";
lError() << "createClientGroupChatRoom(): local address [" << conferenceId.getLocalAddress() << "] must have a gruu.";
return nullptr;
}
shared_ptr<ClientGroupChatRoom> clientGroupChatRoom(new ClientGroupChatRoom(q->getSharedFromThis(),
......@@ -263,6 +263,12 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo
ChatRoomParams::toCapabilities(params),
params,
false);
if (!chatRoom) {
lWarning() << "Cannot create createClientGroupChatRoom with subject [" << subject <<"]";
return nullptr;
}
chatRoom->addParticipants(participants, nullptr, false);
#else
lWarning() << "Advanced IM such as group chat is disabled!";
......
......@@ -5527,6 +5527,15 @@ static void core_stop_start_with_chat_room_ref (void) {
//now GC is cleaning old chatroom
if (pauline1Cr) linphone_chat_room_unref(pauline1Cr);
//test very early client group chatroom creation, should fail
linphone_proxy_config_set_conference_factory_uri(linphone_core_get_default_proxy_config(pauline1->lc), sFactoryUri);
LinphoneChatRoomParams *params = linphone_core_create_default_chat_room_params(pauline1->lc);
linphone_chat_room_params_set_backend(params, LinphoneChatRoomBackendFlexisipChat);
LinphoneChatRoom *chatRoom = linphone_core_create_chat_room_2(pauline1->lc, params, initialSubject,participantsAddresses);
linphone_chat_room_params_unref(params);
BC_ASSERT_PTR_NULL(chatRoom);
coresList = bctbx_list_remove(coresList, pauline1->lc);
linphone_core_manager_reinit(pauline1);
bctbx_list_t *tmpCoresManagerList = bctbx_list_append(NULL, pauline1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment