Tweak conditions again

This commit is contained in:
Neil Alexander 2022-02-22 14:54:24 +00:00
parent 84f8e675d4
commit 29d93f3e91
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -85,10 +85,10 @@ func (m1 *DeviceMessage) DeviceKeysEqual(m2 *DeviceMessage) (bool, error) {
if m1.DisplayName != m2.DisplayName { if m1.DisplayName != m2.DisplayName {
return false, nil // different display names return false, nil // different display names
} }
if len(m1.KeyJSON) == 0 && len(m2.KeyJSON) == 0 { if len(m1.KeyJSON) == 0 || len(m2.KeyJSON) == 0 {
return true, nil // both are empty return false, nil // both are empty
} }
return bytes.Equal(m1.KeyJSON, m2.KeyJSON) && len(m1.KeyJSON) > 0, nil return bytes.Equal(m1.KeyJSON, m2.KeyJSON), nil
} }
// DeviceKeys represents a set of device keys for a single device // DeviceKeys represents a set of device keys for a single device