Skip to content

Commit

Permalink
Merge pull request #40 from cmars/upstream-fix-nodes-nil-lastseen
Browse files Browse the repository at this point in the history
Fix nil dereference in nodes list command.
  • Loading branch information
juanfont authored Jun 20, 2021
2 parents a63fb6b + fdcd3bb commit 73186ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/headscale/cli/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"strings"
"time"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -71,7 +72,11 @@ var ListNodesCmd = &cobra.Command{
if m.AuthKey != nil && m.AuthKey.Ephemeral {
ephemeral = true
}
fmt.Printf("%s\t%s\t%t\n", m.Name, m.LastSeen.Format("2006-01-02 15:04:05"), ephemeral)
var lastSeen time.Time
if m.LastSeen != nil {
lastSeen = *m.LastSeen
}
fmt.Printf("%s\t%s\t%t\n", m.Name, lastSeen.Format("2006-01-02 15:04:05"), ephemeral)
}

},
Expand Down

0 comments on commit 73186ee

Please sign in to comment.