From 63ef35a005ec2c0649f135625696b1bd3dc4abab Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:41:36 -0800 Subject: [PATCH] Fix USB drive detection logic for empty arrays Replaces null comparison with count check to properly handle empty arrays. The previous condition would incorrectly pass when the array exists but contains no elements, potentially causing the function to proceed without a valid USB drive. --- FFUDevelopment/BuildFFUVM.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 8364070..ebf30f2 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -3494,7 +3494,7 @@ Function Get-USBDrive { } # Check if any USB drives were found - if ($null -eq $USBDrives) { + if ($USBDrives.Count -eq 0) { WriteLog "No USB drive found. Exiting" Write-Error "No USB drive found. Exiting" exit 1