Fix #45: ensure we don't send null when we mean []

This commit is contained in:
Kegan Dougal 2022-09-20 13:19:28 +01:00
parent d591dd0584
commit b90a18a62a
2 changed files with 4 additions and 2 deletions

View File

@ -339,6 +339,8 @@ func (p *Poller) FallbackKeyTypes() []string {
func (p *Poller) DeviceListChanges() (changed, left []string) {
p.e2eeMu.Lock()
defer p.e2eeMu.Unlock()
changed = make([]string, 0)
left = make([]string, 0)
for userID, state := range p.deviceListChanges {
switch state {
case "changed":

View File

@ -19,8 +19,8 @@ func (r AccountDataRequest) ApplyDelta(next *AccountDataRequest) *AccountDataReq
// Server response
type AccountDataResponse struct {
Global []json.RawMessage `json:"global"`
Rooms map[string][]json.RawMessage `json:"rooms"`
Global []json.RawMessage `json:"global,omitempty"`
Rooms map[string][]json.RawMessage `json:"rooms,omitempty"`
}
func (r *AccountDataResponse) HasData(isInitial bool) bool {