Skip to content

Commit

Permalink
graph/path: make AllShortest safe for length zero
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Nov 20, 2018
1 parent 3b99883 commit 5b0db96
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions graph/path/shortest.go
Expand Up @@ -197,6 +197,9 @@ type AllShortest struct {
}

func newAllShortest(nodes []graph.Node, forward bool) AllShortest {
if len(nodes) == 0 {
return AllShortest{}
}
indexOf := make(map[int64]int, len(nodes))
for i, n := range nodes {
indexOf[n.ID()] = i
Expand Down

0 comments on commit 5b0db96

Please sign in to comment.