diff --git a/eng/common/scripts/Verify-Links.ps1 b/eng/common/scripts/Verify-Links.ps1 index 62fd3df9875..396ece4ac37 100644 --- a/eng/common/scripts/Verify-Links.ps1 +++ b/eng/common/scripts/Verify-Links.ps1 @@ -260,7 +260,7 @@ function CheckLink ([System.Uri]$linkUri, $allowRetry=$true) $innerExceptionPresent = $_.Exception.psobject.Properties.name -contains "InnerException" $errorCodePresent = $false - if ($innerExceptionPresent) { + if ($innerExceptionPresent -and $_.Exception.InnerException) { $errorCodePresent = $_.Exception.InnerException.psobject.Properties.name -contains "ErrorCode" }