providers/aws: more guards against crashy cases [GH-2308]

This commit is contained in:
Mitchell Hashimoto 2015-06-23 16:23:24 -07:00
parent 642bdd585f
commit b0169adf02

View File

@ -257,7 +257,7 @@ func findResourceSecurityGroup(conn *ec2.EC2, id string) (*ec2.SecurityGroup, er
if err != nil {
return nil, err
}
if len(resp.SecurityGroups) != 1 {
if resp == nil || len(resp.SecurityGroups) != 1 {
return nil, fmt.Errorf(
"Expected to find one security group with ID %q, got: %#v",
id, resp.SecurityGroups)