Merge pull request #5588 from hashicorp/b-digital-ocean-droplet-panic

Fix panic in digital_ocean_droplet if resp is nil
This commit is contained in:
Paul Stack 2016-03-14 12:37:29 +00:00
commit 908a2cc178
1 changed files with 1 additions and 1 deletions

View File

@ -189,7 +189,7 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
droplet, resp, err := client.Droplets.Get(id) droplet, resp, err := client.Droplets.Get(id)
if err != nil { if err != nil {
// check if the droplet no longer exists. // check if the droplet no longer exists.
if resp.StatusCode == 404 { if resp != nil && resp.StatusCode == 404 {
log.Printf("[WARN] DigitalOcean Droplet (%s) not found", d.Id()) log.Printf("[WARN] DigitalOcean Droplet (%s) not found", d.Id())
d.SetId("") d.SetId("")
return nil return nil