fix(message/service): fix crash on missing assignment of MessageResult
Fixes #12195
This commit is contained in:
parent
7cef5fcbf5
commit
fb4f77b9bb
|
@ -572,10 +572,13 @@ QtObject:
|
||||||
|
|
||||||
proc getMessageByMessageId*(self: Service, messageId: string): GetMessageResult =
|
proc getMessageByMessageId*(self: Service, messageId: string): GetMessageResult =
|
||||||
try:
|
try:
|
||||||
|
result = GetMessageResult()
|
||||||
let msgResponse = status_go.getMessageByMessageId(messageId)
|
let msgResponse = status_go.getMessageByMessageId(messageId)
|
||||||
if msgResponse.error.isNil:
|
if not msgResponse.error.isNil:
|
||||||
result.message = msgResponse.result.toMessageDto()
|
let error = Json.decode($msgResponse.error, RpcError)
|
||||||
|
raise newException(RpcException, "Error resending chat message: " & error.message)
|
||||||
|
|
||||||
|
result.message = msgResponse.result.toMessageDto()
|
||||||
if result.message.id.len == 0:
|
if result.message.id.len == 0:
|
||||||
result.error = "message with id: " & messageId & " doesn't exist"
|
result.error = "message with id: " & messageId & " doesn't exist"
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue