diff --git a/pkg/bookmarks/bookmarks.go b/pkg/bookmarks/bookmarks.go index 758eeb1..7bddc09 100644 --- a/pkg/bookmarks/bookmarks.go +++ b/pkg/bookmarks/bookmarks.go @@ -25,7 +25,7 @@ type Bookmark struct { } func (b Bookmark) SSHInfoIsEmpty() bool { - return b.Ssh.User == "" && b.Ssh.Host == "" && b.Ssh.Port == "" + return b.Ssh == nil || b.Ssh.User == "" && b.Ssh.Host == "" && b.Ssh.Port == "" } func (b Bookmark) ConvertToOptions() command.Options { diff --git a/pkg/bookmarks/bookmarks_test.go b/pkg/bookmarks/bookmarks_test.go index 5584edc..61221a4 100644 --- a/pkg/bookmarks/bookmarks_test.go +++ b/pkg/bookmarks/bookmarks_test.go @@ -106,7 +106,10 @@ func Test_Bookmark_SSHInfoIsEmpty(t *testing.T) { User: "postgres", } - b := Bookmark{Ssh: emptySSH} + b := Bookmark{Ssh: nil} + assert.True(t, b.SSHInfoIsEmpty()) + + b = Bookmark{Ssh: emptySSH} assert.True(t, b.SSHInfoIsEmpty()) b.Ssh = populatedSSH