~emersion/soju

de0992d41e6075c294559cf6420df2414d3ce48c — Simon Ser 16 days ago 3863b8c
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.
1 files changed, 6 insertions(+), 1 deletions(-)

M downstream.go
M downstream.go => downstream.go +6 -1
@@ 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
	}