From 2624a28a52b29713f7ac13b95e0d43f969a1d47c Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Mon, 25 Nov 2024 15:24:01 +0100 Subject: [PATCH] webhooks: do not crash when expire is NULL This is currently not possible to create a webhook without an expiry date. But the SQL database schema does not forbid it. If in the future we would like to allow webhooks to be created without an expiry date, we shouldn't crash when fetching them. Check for the validity of the Expiry field before checking its value. If it is nil, assume that the webhooks has no expiry date. Signed-off-by: Robin Jarry --- webhooks/queue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webhooks/queue.go b/webhooks/queue.go index 5cfcc6719028fc2e8c3489a4caa75300670f62f7..8286034d4d2340d8704fb5fd694dcdb977dda652 100644 --- a/webhooks/queue.go +++ b/webhooks/queue.go @@ -152,7 +152,7 @@ func (queue *WebhookQueue) fetchSubscriptions(ctx context.Context, &sub.NodeID); err != nil { panic(err) } - if sub.Expires.After(time.Now()) { + if sub.Expires == nil || sub.Expires.After(time.Now()) { subs = append(subs, &sub) } }