diff --git a/autopilot/simple_graph.go b/autopilot/simple_graph.go index f7bf4c12c..08476414b 100644 --- a/autopilot/simple_graph.go +++ b/autopilot/simple_graph.go @@ -132,6 +132,11 @@ func (graph *SimpleGraph) shortestPathLengths(node int) map[int]uint32 { // thisLevel contains the nodes that are explored in the round. thisLevel := make([]int, 0, graphOrder) + // Abort if we have an empty graph. + if len(graph.Adj) == 0 { + return seen + } + // We discover other nodes in a ring-like structure as long as we don't // have more nodes to explore. for len(nextLevel) > 0 {