bugfix: ensure we don't append nothing else we can end up with null arrays

Caught by element-web cypress tests, which consistently failed.
This commit is contained in:
Kegan Dougal 2023-02-10 14:02:21 +00:00
parent c063352508
commit 3c964de004

View File

@ -53,7 +53,9 @@ func (r *AccountDataRequest) AppendLive(ctx context.Context, res *Response, extC
if err != nil { if err != nil {
logger.Err(err).Str("user", extCtx.UserID).Str("room", update.RoomID()).Msg("failed to fetch room account data") logger.Err(err).Str("user", extCtx.UserID).Str("room", update.RoomID()).Msg("failed to fetch room account data")
} else { } else {
roomToMsgs[update.RoomID()] = accountEventsAsJSON(roomAccountData) if len(roomAccountData) > 0 { // else we can end up with `null` not `[]`
roomToMsgs[update.RoomID()] = accountEventsAsJSON(roomAccountData)
}
} }
} }
} }