From 3aaf7360c9cf2e4de3ef08625784ec989281adf2 Mon Sep 17 00:00:00 2001 From: Jernej Kos Date: Fri, 13 Oct 2023 11:08:00 +0200 Subject: [PATCH] go/worker/client: Fix nil dereference on early Query --- .changelog/5403.bugfix.md | 1 + go/worker/client/committee/node.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .changelog/5403.bugfix.md diff --git a/.changelog/5403.bugfix.md b/.changelog/5403.bugfix.md new file mode 100644 index 00000000000..cfe6cc5340a --- /dev/null +++ b/.changelog/5403.bugfix.md @@ -0,0 +1 @@ +go/worker/client: Fix nil dereference on early Query diff --git a/go/worker/client/committee/node.go b/go/worker/client/committee/node.go index c73f0f6df14..2702994c6a4 100644 --- a/go/worker/client/committee/node.go +++ b/go/worker/client/committee/node.go @@ -143,13 +143,14 @@ func (n *Node) Query(ctx context.Context, round uint64, method string, args []by // Fetch the active descriptor so we can get the current message limits. n.commonNode.CrossNode.Lock() dsc := n.commonNode.CurrentDescriptor - latestRound := n.commonNode.CurrentBlock.Header.Round + blk := n.commonNode.CurrentBlock n.commonNode.CrossNode.Unlock() - if dsc == nil { + if dsc == nil || blk == nil { return nil, api.ErrNoHostedRuntime } maxMessages := dsc.Executor.MaxMessages + latestRound := n.commonNode.CurrentBlock.Header.Round var resolvedRound uint64 queryFn := func(round uint64) ([]byte, error) {