downstream: fix panic in findWebPushSubscription for unbound conns

This code has been missed when adding webpush support for downstream
connections without an upstream network bound.
This commit is contained in:
Simon Ser 2022-06-15 09:09:28 +02:00
parent 3863b8cb6b
commit de0992d41e
1 changed files with 6 additions and 1 deletions

View File

@ -3377,7 +3377,12 @@ func (dc *downstreamConn) handleNickServPRIVMSG(ctx context.Context, uc *upstrea
}
func (dc *downstreamConn) findWebPushSubscription(ctx context.Context, endpoint string) (*database.WebPushSubscription, error) {
subs, err := dc.user.srv.db.ListWebPushSubscriptions(ctx, dc.network.ID)
var networkID int64
if dc.network != nil {
networkID = dc.network.ID
}
subs, err := dc.user.srv.db.ListWebPushSubscriptions(ctx, networkID)
if err != nil {
return nil, err
}