From 02bd274a6e7ded7db4e8e36c3ab6fcd703dc8477 Mon Sep 17 00:00:00 2001 From: Jon Carrier Date: Sat, 6 Jan 2024 18:45:11 -0500 Subject: [PATCH 1/2] Fixed array bounds issue If there is only one table to parse in the `winget update` output the array bounds would produce an error. To prevent this, an additional check has been added. --- WinGet-Essentials/modules/WinGet-Update.psm1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/WinGet-Essentials/modules/WinGet-Update.psm1 b/WinGet-Essentials/modules/WinGet-Update.psm1 index 69c7467..576026b 100644 --- a/WinGet-Essentials/modules/WinGet-Update.psm1 +++ b/WinGet-Essentials/modules/WinGet-Update.psm1 @@ -87,13 +87,14 @@ function Get-WinGetSoftwareUpgrade } } - if (-not($cached)) - { + if (-not($cached)) { $lastLineRegex = "\d+ upgrades available\." $splitIndex = ($response | Select-String $lastLineRegex).LineNumber $upgrades = $response | ConvertFrom-TextTable -LastLineRegEx $lastLineRegex $lastLineRegex = "\d+ package\(s\)" - $upgrades += $response[$splitIndex..($response.Count-1)] | ConvertFrom-TextTable -LastLineRegEx $lastLineRegex + if ($splitIndex -le ($response.Count-1)) { + $upgrades += $response[$splitIndex..($response.Count-1)] | ConvertFrom-TextTable -LastLineRegEx $lastLineRegex + } if ($UseIgnores) { $upgrades = $upgrades | Where-Object { From 04b53d1be1c470c4bc297e1ddc7be3537e3ac1e4 Mon Sep 17 00:00:00 2001 From: Jon Carrier Date: Sat, 6 Jan 2024 18:45:50 -0500 Subject: [PATCH 2/2] Updated psd1 --- WinGet-Essentials/WinGet-Essentials.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WinGet-Essentials/WinGet-Essentials.psd1 b/WinGet-Essentials/WinGet-Essentials.psd1 index 80803a8..e1d3a88 100644 --- a/WinGet-Essentials/WinGet-Essentials.psd1 +++ b/WinGet-Essentials/WinGet-Essentials.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'WinGet-Essentials.psm1' - ModuleVersion = '1.10.0' + ModuleVersion = '1.10.1' GUID = '2a2b6c24-d6cc-4d59-a456-e7ccd90afd03' Author = 'Jon Carrier' CompanyName = 'Unknown'