mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Slices can be nil
This commit is contained in:
parent
089506e6af
commit
2316f399c7
|
|
@ -146,7 +146,7 @@ func (s *OutputRoomEvent) processMessage(ore api.OutputNewRoomEvent) error {
|
|||
}
|
||||
|
||||
// Work out which hosts were joined at the event itself.
|
||||
joinedHostsAtEvent, err := s.joinedHostsAtEvent(ore, *oldJoinedHosts)
|
||||
joinedHostsAtEvent, err := s.joinedHostsAtEvent(ore, oldJoinedHosts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,9 @@ func (d *Database) UpdateRoom(
|
|||
roomID, oldEventID, newEventID string,
|
||||
addHosts []types.JoinedHost,
|
||||
removeHosts []string,
|
||||
) (*[]types.JoinedHost, error) {
|
||||
var joinedHostsPtr *[]types.JoinedHost
|
||||
|
||||
err := common.WithTransaction(d.db, func(txn *sql.Tx) error {
|
||||
err := d.insertRoom(ctx, txn, roomID)
|
||||
) (joinedHosts []types.JoinedHost, err error) {
|
||||
err = common.WithTransaction(d.db, func(txn *sql.Tx) error {
|
||||
err = d.insertRoom(ctx, txn, roomID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -96,13 +94,11 @@ func (d *Database) UpdateRoom(
|
|||
}
|
||||
}
|
||||
|
||||
joinedHosts, err := d.selectJoinedHosts(ctx, txn, roomID)
|
||||
joinedHosts, err = d.selectJoinedHosts(ctx, txn, roomID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
joinedHostsPtr = &joinedHosts
|
||||
|
||||
for _, add := range addHosts {
|
||||
err = d.insertJoinedHosts(ctx, txn, roomID, add.MemberEventID, add.ServerName)
|
||||
if err != nil {
|
||||
|
|
@ -114,5 +110,5 @@ func (d *Database) UpdateRoom(
|
|||
}
|
||||
return d.updateRoom(ctx, txn, roomID, newEventID)
|
||||
})
|
||||
return joinedHostsPtr, err
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue