fix: check nil shard (#12927)

This commit is contained in:
Igor Sirotin 2023-12-01 18:36:17 +00:00 committed by GitHub
parent c2bfc6b8f4
commit de89b3ee77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -90,8 +90,8 @@ proc toJsonNode*(communityUrlDataDto: CommunityUrlDataDto): JsonNode =
jsonObj["membersCount"] = %* communityUrlDataDto.membersCount jsonObj["membersCount"] = %* communityUrlDataDto.membersCount
jsonObj["color"] = %* communityUrlDataDto.color jsonObj["color"] = %* communityUrlDataDto.color
jsonObj["communityId"] = %* communityUrlDataDto.communityId jsonObj["communityId"] = %* communityUrlDataDto.communityId
jsonObj["shardCluster"] = %* communityUrlDataDto.shard.cluster jsonObj["shardCluster"] = %*(if communityUrlDataDto.shard != nil: communityUrlDataDto.shard.cluster else: -1)
jsonObj["shardIndex"] = %* communityUrlDataDto.shard.index jsonObj["shardIndex"] = %*(if communityUrlDataDto.shard != nil: communityUrlDataDto.shard.index else: -1)
return jsonObj return jsonObj
proc `$`*(communityUrlDataDto: CommunityUrlDataDto): string = proc `$`*(communityUrlDataDto: CommunityUrlDataDto): string =

View File

@ -46,8 +46,10 @@ StatusDialog {
if (!linkData) { if (!linkData) {
return "" return ""
} }
if (linkData.shardCluster != undefined && linkData.shardIndex != undefined) {
d.shardCluster = linkData.shardCluster d.shardCluster = linkData.shardCluster
d.shardIndex = linkData.shardIndex d.shardIndex = linkData.shardIndex
}
return linkData.communityId return linkData.communityId
} }
if (!Utils.isCommunityPublicKey(inputKey)) if (!Utils.isCommunityPublicKey(inputKey))