diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-06-15 12:50:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 12:50:02 +0200 |
commit | 1b90cc95367947fa00616b4426d0c894b33c9862 (patch) | |
tree | 9f286fb3dd25c1059995835192de8ec7b463e974 | |
parent | 4c2a10f1a61a79ed8bbe17af1b28532c3d24c261 (diff) |
Fix rare panic when returning user devices over federation (#2534)
-rw-r--r-- | federationapi/routing/devices.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/federationapi/routing/devices.go b/federationapi/routing/devices.go index 1a092645..2f9da1f2 100644 --- a/federationapi/routing/devices.go +++ b/federationapi/routing/devices.go @@ -85,6 +85,9 @@ func GetUserDevices( if targetKey, ok := targetUser[gomatrixserverlib.KeyID(dev.DeviceID)]; ok { for sourceUserID, forSourceUser := range targetKey { for sourceKeyID, sourceKey := range forSourceUser { + if device.Keys.Signatures == nil { + device.Keys.Signatures = map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{} + } if _, ok := device.Keys.Signatures[sourceUserID]; !ok { device.Keys.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{} } |