Don't assert nil values in convertStringArr

Some of the inputs to this function may not have been validated
This commit is contained in:
James Bardin 2016-10-19 10:06:13 -04:00
parent 1a08318a45
commit 4be35a5e4e
1 changed files with 6 additions and 3 deletions

View File

@ -89,9 +89,12 @@ func resourceComputeTargetPool() *schema.Resource {
}
func convertStringArr(ifaceArr []interface{}) []string {
arr := make([]string, len(ifaceArr))
for i, v := range ifaceArr {
arr[i], _ = v.(string)
var arr []string
for _, v := range ifaceArr {
if v == nil {
continue
}
arr = append(arr, v.(string))
}
return arr
}