[bugfix] check for nil notification (#4417)

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4417
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2025-09-07 18:16:43 +02:00 committed by kim
commit 9b7db51436

View file

@ -166,6 +166,14 @@ func (p *Processor) NotificationGet(ctx context.Context, account *gtsmodel.Accou
return nil, gtserror.NewErrorInternalError(err)
}
if notif == nil {
const text = "notification not found"
return nil, gtserror.NewErrorNotFound(
errors.New(text),
text,
)
}
if notif.TargetAccountID != account.ID {
err := gtserror.New("requester does not match notification target")
return nil, gtserror.NewErrorNotFound(err)