aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2022-03-01 14:22:59 +0000
committerKegan Dougal <kegan@matrix.org>2022-03-01 14:22:59 +0000
commit18e3c40da43017a9e1abe775a406844aca5e1643 (patch)
treece105e9bd28ac38c53332bc37945b8b57f2c3f49 /setup
parent1a79060b46d3b9c6dc0083fd7b20a2471f795a90 (diff)
Always send [] from federated rooms, not null
Diffstat (limited to 'setup')
-rw-r--r--setup/mscs/msc2946/msc2946.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/setup/mscs/msc2946/msc2946.go b/setup/mscs/msc2946/msc2946.go
index 3bb56f4b..bf26e991 100644
--- a/setup/mscs/msc2946/msc2946.go
+++ b/setup/mscs/msc2946/msc2946.go
@@ -426,6 +426,18 @@ func (w *walker) federatedRoomInfo(roomID string, vias []string) (*gomatrixserve
util.GetLogger(w.ctx).WithError(err).Warnf("failed to call MSC2946Spaces on server %s", serverName)
continue
}
+ // ensure nil slices are empty as we send this to the client sometimes
+ if res.Room.ChildrenState == nil {
+ res.Room.ChildrenState = []gomatrixserverlib.MSC2946StrippedEvent{}
+ }
+ for i := 0; i < len(res.Children); i++ {
+ child := res.Children[i]
+ if child.ChildrenState == nil {
+ child.ChildrenState = []gomatrixserverlib.MSC2946StrippedEvent{}
+ }
+ res.Children[i] = child
+ }
+
return &res, nil
}
return nil, nil