Skip to content

Commit

Permalink
Add nil check on bq destination array contents (#3774)
Browse files Browse the repository at this point in the history
  • Loading branch information
slevenick authored Jul 22, 2020
1 parent 3342f32 commit 8576220
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3033,8 +3033,9 @@ func expandResourceUsageExportConfig(configured interface{}) *containerBeta.Reso
ForceSendFields: []string{"EnableNetworkEgressMetering"},
}
if _, ok := resourceUsageConfig["bigquery_destination"]; ok {
if len(resourceUsageConfig["bigquery_destination"].([]interface{})) > 0 {
bigqueryDestination := resourceUsageConfig["bigquery_destination"].([]interface{})[0].(map[string]interface{})
destinationArr := resourceUsageConfig["bigquery_destination"].([]interface{})
if len(destinationArr) > 0 && destinationArr[0] != nil {
bigqueryDestination := destinationArr[0].(map[string]interface{})
if _, ok := bigqueryDestination["dataset_id"]; ok {
result.BigqueryDestination = &containerBeta.BigQueryDestination{
DatasetId: bigqueryDestination["dataset_id"].(string),
Expand Down

0 comments on commit 8576220

Please sign in to comment.