mirror of https://github.com/docker/docs.git
Fix panic when instance doesn't exist remotely
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
parent
a7d1a70442
commit
8d0bf21c6d
|
@ -402,6 +402,8 @@ func (d *Driver) GetState() (state.State, error) {
|
|||
return state.Stopping, nil
|
||||
case "stopped":
|
||||
return state.Stopped, nil
|
||||
default:
|
||||
return state.Error, nil
|
||||
}
|
||||
return state.None, nil
|
||||
}
|
||||
|
|
|
@ -501,9 +501,11 @@ func (e *EC2) GetInstance(instanceId string) (EC2Instance, error) {
|
|||
return ec2Instance, fmt.Errorf("Error unmarshalling AWS response XML: %s", err)
|
||||
}
|
||||
|
||||
reservationSet := unmarshalledResponse.ReservationSet[0]
|
||||
instance := reservationSet.InstancesSet[0]
|
||||
return instance, nil
|
||||
if len(unmarshalledResponse.ReservationSet) > 0 {
|
||||
reservationSet := unmarshalledResponse.ReservationSet[0]
|
||||
ec2Instance = reservationSet.InstancesSet[0]
|
||||
}
|
||||
return ec2Instance, nil
|
||||
}
|
||||
|
||||
func (e *EC2) StartInstance(instanceId string) error {
|
||||
|
|
Loading…
Reference in New Issue