Merge pull request #296 from sosedoff/ssh-hotfix
Fix panics when sshinfo is not set on bookmarks
This commit is contained in:
commit
7381ff8589
@ -25,7 +25,7 @@ type Bookmark struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b Bookmark) SSHInfoIsEmpty() bool {
|
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 {
|
func (b Bookmark) ConvertToOptions() command.Options {
|
||||||
|
@ -106,7 +106,10 @@ func Test_Bookmark_SSHInfoIsEmpty(t *testing.T) {
|
|||||||
User: "postgres",
|
User: "postgres",
|
||||||
}
|
}
|
||||||
|
|
||||||
b := Bookmark{Ssh: emptySSH}
|
b := Bookmark{Ssh: nil}
|
||||||
|
assert.True(t, b.SSHInfoIsEmpty())
|
||||||
|
|
||||||
|
b = Bookmark{Ssh: emptySSH}
|
||||||
assert.True(t, b.SSHInfoIsEmpty())
|
assert.True(t, b.SSHInfoIsEmpty())
|
||||||
|
|
||||||
b.Ssh = populatedSSH
|
b.Ssh = populatedSSH
|
||||||
|
Loading…
x
Reference in New Issue
Block a user