null check on $ContentTypes (#9687)

This commit is contained in:
William Cheng 2021-06-08 09:09:21 +08:00 committed by GitHub
parent 7125ef43f5
commit 37b7c80c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -211,6 +211,10 @@ function DeserializeResponse {
[string[]]$ContentTypes [string[]]$ContentTypes
) )
If ($ContentTypes -eq $null) {
$ContentTypes = [string[]]@()
}
If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response
return $Response return $Response
} Elseif ($ReturnType -match '\[\]$') { # array } Elseif ($ReturnType -match '\[\]$') { # array

View File

@ -198,6 +198,10 @@ function DeserializeResponse {
[string[]]$ContentTypes [string[]]$ContentTypes
) )
If ($ContentTypes -eq $null) {
$ContentTypes = [string[]]@()
}
If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response
return $Response return $Response
} Elseif ($ReturnType -match '\[\]$') { # array } Elseif ($ReturnType -match '\[\]$') { # array