1
0

fix(subscriptions): do not panic when a task does not have a subscription

(cherry picked from commit 75f3e930cd8072fc6709d1e653b177263d02c8ce)
This commit is contained in:
kolaente 2024-09-04 21:55:14 +02:00
parent 8b8ec19bb3
commit 95ef4e1045
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
2 changed files with 4 additions and 2 deletions

View File

@ -171,7 +171,7 @@ func (sb *Subscription) Delete(s *xorm.Session, auth web.Auth) (err error) {
func GetSubscriptionForUser(s *xorm.Session, entityType SubscriptionEntityType, entityID int64, a web.Auth) (subscription *SubscriptionWithUser, err error) { func GetSubscriptionForUser(s *xorm.Session, entityType SubscriptionEntityType, entityID int64, a web.Auth) (subscription *SubscriptionWithUser, err error) {
u, is := a.(*user.User) u, is := a.(*user.User)
if u != nil && !is { if !is || u == nil {
return return
} }

View File

@ -1577,7 +1577,9 @@ func (t *Task) ReadOne(s *xorm.Session, a web.Auth) (err error) {
if err != nil && IsErrProjectDoesNotExist(err) { if err != nil && IsErrProjectDoesNotExist(err) {
return nil return nil
} }
t.Subscription = &subs.Subscription if subs != nil {
t.Subscription = &subs.Subscription
}
return return
} }