diff --git a/clientapi/routing/joinroom.go b/clientapi/routing/joinroom.go index 33ceda5d0..e3e13c9cf 100644 --- a/clientapi/routing/joinroom.go +++ b/clientapi/routing/joinroom.go @@ -239,7 +239,7 @@ func (r joinRoomReq) joinRoomUsingServers( return jsonerror.InternalServerError() } - var queryRes roomserverAPI.QueryLatestEventsAndStateResponse + queryRes := roomserverAPI.QueryLatestEventsAndStateResponse{} event, err := common.BuildEvent(r.req.Context(), &eb, r.cfg, r.evTime, r.queryAPI, &queryRes) if err == nil { if _, err = r.producer.SendEvents(r.req.Context(), []gomatrixserverlib.Event{*event}, r.cfg.Matrix.ServerName, nil); err != nil { diff --git a/clientapi/threepid/invites.go b/clientapi/threepid/invites.go index aa54aa9fa..a21aa2b7b 100644 --- a/clientapi/threepid/invites.go +++ b/clientapi/threepid/invites.go @@ -353,8 +353,8 @@ func emit3PIDInviteEvent( return err } - var queryRes *api.QueryLatestEventsAndStateResponse - event, err := common.BuildEvent(ctx, builder, cfg, evTime, queryAPI, queryRes) + queryRes := api.QueryLatestEventsAndStateResponse{} + event, err := common.BuildEvent(ctx, builder, cfg, evTime, queryAPI, &queryRes) if err != nil { return err } diff --git a/common/events.go b/common/events.go index 5d8ac90df..e49c49fe4 100644 --- a/common/events.go +++ b/common/events.go @@ -76,7 +76,7 @@ func AddPrevEventsToEvent( StateToFetch: eventsNeeded.Tuples(), } if queryRes == nil { - *queryRes = api.QueryLatestEventsAndStateResponse{} + queryRes = &api.QueryLatestEventsAndStateResponse{} } if err = queryAPI.QueryLatestEventsAndState(ctx, &queryReq, queryRes); err != nil { return err