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:
commit
908a2cc178
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue