fix: check default port in map is not nil

This commit is contained in:
Jeff Malnick committed 2020-09-16 13:27:44 -07:00
1 parent 292a5100bf
commit d19dd70b06
1 file changed
+4 -3
+4 -3
View File
@@ -65,9 +65,10 @@ func setFromTargetResponseMap(d *schema.ResourceData, raw map[string]interface{}
case targetTypeTcp:
if attrsVal, ok := raw["attributes"]; ok {
attrs := attrsVal.(map[string]interface{})
defPort := attrs["default_port"].(json.Number)
defPortInt, _ := defPort.Int64()
d.Set(targetDefaultPortKey, int(defPortInt))
if defPort, ok := attrs["default_port"].(json.Number); ok {
defPortInt, _ := defPort.Int64()
d.Set(targetDefaultPortKey, int(defPortInt))
}
}
}