Merge pull request #296 from sosedoff/ssh-hotfix

Fix panics when sshinfo is not set on bookmarks
This commit is contained in:
Dan Sosedoff 2017-10-04 00:31:35 -05:00 committed by GitHub
commit 7381ff8589
2 changed files with 5 additions and 2 deletions

View File

@ -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 {

View File

@ -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