Fix nil pointer exception
This commit is contained in:
parent
139904f604
commit
c1c81afbf6
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue