Merge pull request #2831 from nathanleclaire/aws_panic

Check for nil before deferencing pointer in SG config
This commit is contained in:
Nathan LeClaire 2016-01-13 12:59:49 -08:00
commit 4f6fb6dc7e
1 changed files with 9 additions and 7 deletions

View File

@ -866,13 +866,15 @@ func (d *Driver) configureSecurityGroupPermissions(group *ec2.SecurityGroup) []*
hasDockerPort := false hasDockerPort := false
hasSwarmPort := false hasSwarmPort := false
for _, p := range group.IpPermissions { for _, p := range group.IpPermissions {
switch *p.FromPort { if p.FromPort != nil {
case 22: switch *p.FromPort {
hasSshPort = true case 22:
case int64(dockerPort): hasSshPort = true
hasDockerPort = true case int64(dockerPort):
case int64(swarmPort): hasDockerPort = true
hasSwarmPort = true case int64(swarmPort):
hasSwarmPort = true
}
} }
} }