diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2024-07-27 22:29:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-27 22:29:34 +0200 |
commit | affb6977e43ad5051761d0de650370f421f751b5 (patch) | |
tree | a5bec5b4295d2b400ee18df8f64492a080f1e08b /userapi | |
parent | 795c4a9453e6775714ae73099e2a64df1c41743b (diff) |
Fix nil pointer derefernce issues (#3379)
Discovered while running
https://gitlab.futo.org/load-testing/matrix-goose.
Dendrite locks up and runs into `context cancelled`, so the error is not
`sql.ErrNoRows` nor "default" (and definitely shouldn't return that the
account exists in this case)
Diffstat (limited to 'userapi')
-rw-r--r-- | userapi/internal/user_api.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/userapi/internal/user_api.go b/userapi/internal/user_api.go index a126dc87..fd73bf62 100644 --- a/userapi/internal/user_api.go +++ b/userapi/internal/user_api.go @@ -939,11 +939,12 @@ func (a *UserInternalAPI) QueryAccountByPassword(ctx context.Context, req *api.Q return nil case bcrypt.ErrHashTooShort: // user exists, but probably a passwordless account return nil - default: + case nil: res.Exists = true res.Account = acc return nil } + return err } func (a *UserInternalAPI) SetDisplayName(ctx context.Context, localpart string, serverName spec.ServerName, displayName string) (*authtypes.Profile, bool, error) { |