mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Prevent panic in membership updater (#1021)
This commit is contained in:
parent
99e0a7dff2
commit
0c892d59fa
1 changed files with 8 additions and 0 deletions
|
@ -16,6 +16,7 @@ package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
|
@ -106,6 +107,13 @@ func updateMembership(
|
||||||
return updates, nil
|
return updates, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if add == nil {
|
||||||
|
// This shouldn't happen. Returning an error here is better than panicking
|
||||||
|
// in the membership updater functions later on.
|
||||||
|
// TODO: Why does this happen to begin with?
|
||||||
|
return updates, errors.New("add should not be nil")
|
||||||
|
}
|
||||||
|
|
||||||
mu, err := updater.MembershipUpdater(targetUserNID)
|
mu, err := updater.MembershipUpdater(targetUserNID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue