Skip to content

Commit 97791b1

Browse files
Fix issue in Verify-Link.ps1 after PS 7.4 update (#38605)
https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-74?view=powershell-7.4 - Add AllowInsecureRedirect switch to Web cmdlets (#18546) That new option cause a new exception type that exposed a bug where we assumed if InnerException property existed that it was not null. This fix verifies that the property is not null. Co-authored-by: Wes Haggard <[email protected]>
1 parent 8446ecc commit 97791b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eng/common/scripts/Verify-Links.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function CheckLink ([System.Uri]$linkUri, $allowRetry=$true)
260260
$innerExceptionPresent = $_.Exception.psobject.Properties.name -contains "InnerException"
261261

262262
$errorCodePresent = $false
263-
if ($innerExceptionPresent) {
263+
if ($innerExceptionPresent -and $_.Exception.InnerException) {
264264
$errorCodePresent = $_.Exception.InnerException.psobject.Properties.name -contains "ErrorCode"
265265
}
266266

0 commit comments

Comments
 (0)