From d4672ea2f8081b81b44bea24147aa01d1a9e8b99 Mon Sep 17 00:00:00 2001 From: ucwong Date: Fri, 24 Nov 2023 18:13:37 +0800 Subject: [PATCH] eth/downloader/downloader.go : potential panic --- eth/downloader/downloader.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 2ca7e328c6..844ce566f2 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -1614,6 +1614,10 @@ func (d *Downloader) processSnapSyncContent() error { } // Split around the pivot block and process the two sides via snap/full sync if !d.committed.Load() { + if len(results) == 0 { + continue + } + latest := results[len(results)-1].Header // If the height is above the pivot block by 2 sets, it means the pivot // become stale in the network, and it was garbage collected, move to a