From ac0d29580eb7b161c3032b4ba32d2edf80276158 Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Fri, 2 Aug 2024 14:26:09 +0200 Subject: [PATCH] channeldb: skip nil scheduler options This is a robustness option to ensure LND doesn't crash when this function is accidentally called with `AddChannelEdge(edge, nil)`. --- channeldb/graph.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/channeldb/graph.go b/channeldb/graph.go index 86cbe9aa9..d7a4480d0 100644 --- a/channeldb/graph.go +++ b/channeldb/graph.go @@ -1023,6 +1023,10 @@ func (c *ChannelGraph) AddChannelEdge(edge *models.ChannelEdgeInfo, } for _, f := range op { + if f == nil { + return fmt.Errorf("nil scheduler option was used") + } + f(r) }