fix(message_handler): fix error when there is no record and fix crash

This commit is contained in:
Jonathan Rainville 2023-01-11 12:43:04 -05:00
parent 883f9677c5
commit 7717f9519f
2 changed files with 3 additions and 4 deletions

View File

@ -1 +1 @@
0.122.1
0.122.2

View File

@ -1532,12 +1532,11 @@ func (m *Messenger) HandleChatMessage(state *ReceivedMessageState) error {
// If the message is a reply, we check if it's a reply to one of own own messages
if receivedMessage.ResponseTo != "" {
repliedTo, err := m.persistence.MessageByID(receivedMessage.ResponseTo)
if err != nil && err == sql.ErrNoRows {
if err != nil && (err == sql.ErrNoRows || err == common.ErrRecordNotFound) {
logger.Error("failed to get quoted message", zap.Error(err))
} else if err != nil {
return err
}
if repliedTo.From == common.PubkeyToHex(&m.identity.PublicKey) {
} else if repliedTo.From == common.PubkeyToHex(&m.identity.PublicKey) {
receivedMessage.Replied = true
}
}