Fix bug with nil interface return & add test

This commit is contained in:
Devon Hudson 2023-05-18 13:41:47 -06:00
parent 345f025ee3
commit 027a9b8ce0
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
2 changed files with 38 additions and 1 deletions

View file

@ -868,7 +868,11 @@ func (r *Queryer) QueryRoomInfo(ctx context.Context, roomID spec.RoomID) (*types
}
func (r *Queryer) CurrentStateEvent(ctx context.Context, roomID spec.RoomID, eventType string, stateKey string) (gomatrixserverlib.PDU, error) {
return r.DB.GetStateEvent(ctx, roomID.String(), string(eventType), "")
res, err := r.DB.GetStateEvent(ctx, roomID.String(), string(eventType), "")
if res == nil {
return nil, err
}
return res, err
}
func (r *Queryer) UserJoinedToRoom(ctx context.Context, roomNID types.RoomNID, userID spec.UserID) (bool, error) {