Skip to content

Commit

Permalink
Fixing null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelgrzeda committed Jul 15, 2020
1 parent 26d6b53 commit e877b49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ func (p *ec2Provider) Start(ctx gocontext.Context, startAttributes *StartAttribu
if instances != nil {
instance := instances.Reservations[0].Instances[0]
address := *instance.PrivateIpAddress
if p.publicIPConnect {
if instance.PublicIpAddress != nil && p.publicIPConnect {
address = *instance.PublicIpAddress
}
if address != "" {
Expand Down Expand Up @@ -633,7 +633,7 @@ func (i *ec2Instance) uploadScriptSCP(ctx gocontext.Context, script []byte) erro

func (i *ec2Instance) sshConnection(ctx gocontext.Context) (ssh.Connection, error) {
ip := *i.instance.PrivateIpAddress
if i.provider.publicIPConnect {
if i.instance.PublicIpAddress != nil && i.provider.publicIPConnect {
ip = *i.instance.PublicIpAddress
}
return i.sshDialer.Dial(fmt.Sprintf("%s:22", ip), defaultEC2SSHUserName, i.provider.sshDialTimeout)
Expand Down

0 comments on commit e877b49

Please sign in to comment.