When keyring is empty KeyRing.FirstKey returns nil (#25)
This commit is contained in:
parent
72e33612c4
commit
52ecc1ce36
1 changed files with 4 additions and 1 deletions
|
|
@ -450,9 +450,12 @@ func FilterExpiredKeys(contactKeys []*KeyRing) (filteredKeys []*KeyRing, err err
|
|||
|
||||
// FirstKey returns a KeyRing with only the first key of the original one
|
||||
func (keyRing *KeyRing) FirstKey() *KeyRing {
|
||||
if len(keyRing.entities) == 0 {
|
||||
return nil
|
||||
}
|
||||
newKeyRing := &KeyRing{}
|
||||
newKeyRing.FirstKeyID = keyRing.FirstKeyID
|
||||
newKeyRing.entities = keyRing.entities[:1]
|
||||
|
||||
return newKeyRing;
|
||||
return newKeyRing
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue