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 width: rectangleBubbleLoader.width
function getCommunity() { function getCommunity() {
let community = JSON.parse(chatsModel.communities.list.getCommunityByIdJson(communityId)); try {
if (community) { const communityJson = chatsModel.communities.list.getCommunityByIdJson(communityId)
community.nbMembers = community.members.length; 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: { Component.onCompleted: {