Skip to content

Commit

Permalink
Fix things in parseRoomStateArray
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 30, 2021
1 parent ddd5a8b commit 664493c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ func (cli *Client) StateEvent(roomID id.RoomID, eventType event.Type, stateKey s
// parseRoomStateArray parses a JSON array as a stream and stores the events inside it in a room state map.
func parseRoomStateArray(_ *http.Request, res *http.Response, responseJSON interface{}) ([]byte, error) {
response := make(RoomStateMap)
responsePtr := responseJSON.(*interface{})
responsePtr := responseJSON.(*map[event.Type]map[string]*event.Event)
*responsePtr = response
dec := json.NewDecoder(res.Body)

Expand All @@ -1098,6 +1098,7 @@ func parseRoomStateArray(_ *http.Request, res *http.Response, responseJSON inter
if err != nil {
return nil, fmt.Errorf("failed to parse state array item #%d: %v", i, err)
}
_ = evt.Content.ParseRaw(evt.Type)
subMap, ok := response[evt.Type]
if !ok {
subMap = make(map[string]*event.Event)
Expand Down

0 comments on commit 664493c

Please sign in to comment.