fix(invitation-bubble): fix json parse

This commit is contained in:
Jonathan Rainville 2021-07-22 11:22:02 -04:00 committed by Iuri Matias
parent 58532ba25d
commit ed223f15da
1 changed files with 15 additions and 4 deletions

View File

@ -18,11 +18,22 @@ Item {
width: rectangleBubbleLoader.width
function getCommunity() {
let community = JSON.parse(chatsModel.communities.list.getCommunityByIdJson(communityId));
if (community) {
community.nbMembers = community.members.length;
try {
const communityJson = chatsModel.communities.list.getCommunityByIdJson(communityId)
if (!communityJson) {
return null
}
let community = JSON.parse(communityJson);
if (community) {
community.nbMembers = community.members.length;
}
return community
} catch (e) {
console.error("Error parsing community", e)
}
return community
return null
}
Component.onCompleted: {