From 0aa1fb9effb4ae91b43d5a2a99e4cee165f470e0 Mon Sep 17 00:00:00 2001 From: Mikhail Rogachev Date: Thu, 14 Mar 2024 20:56:26 +0100 Subject: [PATCH] Fix: handle accepted contact verifaction if persistedVR is null (#4918) --- protocol/messenger_contact_verification.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/protocol/messenger_contact_verification.go b/protocol/messenger_contact_verification.go index 05016eede..32a0cbfae 100644 --- a/protocol/messenger_contact_verification.go +++ b/protocol/messenger_contact_verification.go @@ -869,20 +869,20 @@ func (m *Messenger) HandleAcceptContactVerification(state *ReceivedMessageState, return err } - if persistedVR != nil && persistedVR.RepliedAt > request.Clock { - return nil // older message, ignore it - } - - if persistedVR.RequestStatus == verification.RequestStatusCANCELED { - return nil // Do nothing, We have already cancelled the verification request - } - if persistedVR == nil { // This is a response for which we have not received its request before persistedVR = &verification.Request{} persistedVR.ID = request.Id persistedVR.From = contactID persistedVR.To = myPubKey + } else { + if persistedVR.RepliedAt > request.Clock { + return nil // older message, ignore it + } + + if persistedVR.RequestStatus == verification.RequestStatusCANCELED { + return nil // Do nothing, We have already cancelled the verification request + } } persistedVR.RequestStatus = verification.RequestStatusACCEPTED