diff --git a/xxmutils/restoreContacts.go b/xxmutils/restoreContacts.go index 1895fa128f3ebdb563518abeba1e29006054d02f..f507af8ae1b8491f364f8e50318d557539086269 100644 --- a/xxmutils/restoreContacts.go +++ b/xxmutils/restoreContacts.go @@ -233,20 +233,23 @@ func LookupContact(userID *id.ID, udManager *ud.Manager, var result *contact.Contact var err error lookupCB := func(c contact.Contact, myErr error) { - if myErr != nil { + if myErr == nil { + newOwnership := make([]byte, len(c.OwnershipProof)) + copy(newOwnership, c.OwnershipProof) + newFacts, _, _ := fact.UnstringifyFactList( + c.Facts.Stringify()) + result = &contact.Contact{ + ID: c.ID.DeepCopy(), + DhPubKey: c.DhPubKey.DeepCopy(), + OwnershipProof: newOwnership, + Facts: newFacts, + } + } else { err = myErr - } - newOwnership := make([]byte, len(c.OwnershipProof)) - copy(newOwnership, c.OwnershipProof) - newFacts, _, _ := fact.UnstringifyFactList(c.Facts.Stringify()) - result = &contact.Contact{ - ID: c.ID.DeepCopy(), - DhPubKey: c.DhPubKey.DeepCopy(), - OwnershipProof: newOwnership, - Facts: newFacts, + result = nil } waiter.Unlock() - extLookupCB(*result, myErr) + extLookupCB(c, myErr) } // Take lock once to make sure I will wait waiter.Lock()