check for nil body from upload response
This commit is contained in:
parent
7810dd18cd
commit
52558e4f75
|
@ -30,9 +30,13 @@ func (s *stepPrepareUpload) Run(state multistep.StateBag) multistep.StepAction {
|
|||
resp, err := client.Get(path)
|
||||
|
||||
if err != nil || (resp.StatusCode != 200) {
|
||||
if resp == nil || resp.Body == nil {
|
||||
state.Put("error", "No response from server.")
|
||||
} else {
|
||||
cloudErrors := &VagrantCloudErrors{}
|
||||
err = decodeBody(resp, cloudErrors)
|
||||
state.Put("error", fmt.Errorf("Error preparing upload: %s", cloudErrors.FormatErrors()))
|
||||
}
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue