fix(message_handler): fix error when there is no record and fix crash
This commit is contained in:
parent
883f9677c5
commit
7717f9519f
|
@ -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 the message is a reply, we check if it's a reply to one of own own messages
|
||||||
if receivedMessage.ResponseTo != "" {
|
if receivedMessage.ResponseTo != "" {
|
||||||
repliedTo, err := m.persistence.MessageByID(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))
|
logger.Error("failed to get quoted message", zap.Error(err))
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
} else if repliedTo.From == common.PubkeyToHex(&m.identity.PublicKey) {
|
||||||
if repliedTo.From == common.PubkeyToHex(&m.identity.PublicKey) {
|
|
||||||
receivedMessage.Replied = true
|
receivedMessage.Replied = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue