mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-30 12:53:34 -06:00
fix null returned session (#159)
This commit is contained in:
parent
2eefaa0227
commit
1582cf8bad
5 changed files with 103 additions and 22 deletions
|
|
@ -47,18 +47,9 @@ func useSession(ctx context.Context, cfg *config.Config, sessionDB db.Session, e
|
|||
// check if we have a saved router session already
|
||||
rs, err := sessionDB.GetSession(ctx)
|
||||
if err != nil {
|
||||
if err != db.ErrNoEntries {
|
||||
// proper error occurred
|
||||
return err
|
||||
}
|
||||
// no session saved so create a new one
|
||||
rs, err = sessionDB.CreateSession(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("error using session: %s", err)
|
||||
}
|
||||
|
||||
if rs == nil {
|
||||
if rs == nil || rs.Auth == nil || rs.Crypt == nil {
|
||||
return errors.New("router session was nil")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue