Add nil check for DirectMessageProtocol object

This commit is contained in:
Vitaliy Vlasov 2021-12-02 13:55:30 +02:00 committed by Vitaliy Vlasov
parent 268c8304a1
commit ea95ce2d4b
1 changed files with 8 additions and 6 deletions

View File

@ -477,12 +477,14 @@ func (p *Protocol) HandleMessage(
if dmProtocol == nil {
dmProtocol = encryptedMessage[noInstallationID]
}
hrHeader := dmProtocol.HRHeader
if hrHeader != nil && hrHeader.SeqNo == 0 {
// Payload contains hash ratchet key
err = p.encryptor.persistence.SaveHashRatchetKey(hrHeader.GroupId, hrHeader.KeyId, message)
if err != nil {
return nil, err
if dmProtocol != nil {
hrHeader := dmProtocol.HRHeader
if hrHeader != nil && hrHeader.SeqNo == 0 {
// Payload contains hash ratchet key
err = p.encryptor.persistence.SaveHashRatchetKey(hrHeader.GroupId, hrHeader.KeyId, message)
if err != nil {
return nil, err
}
}
}