Skip to content

Commit

Permalink
pgraph: Fix rare panic if Sprint is badly used
Browse files Browse the repository at this point in the history
Be nicer.
  • Loading branch information
purpleidea committed Jul 1, 2024
1 parent 5ca9f7f commit 2b3a41f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pgraph/pgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ func (g *Graph) String() string {
// might want to use Logf, which will keep everything aligned with whatever your
// logging prefix is. This function returns the result in a deterministic order.
func (g *Graph) Sprint() string {
if g == nil {
return ""
}
var str string
for _, v := range g.VerticesSorted() {
str += fmt.Sprintf("Vertex: %s\n", v)
Expand Down

0 comments on commit 2b3a41f

Please sign in to comment.