From 7598ee96da65ccaf81879914bc1989baac83dc81 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:04:22 -0700 Subject: [PATCH] Clears existing items in cmbMake dropdown during UI initialization to prevent duplication on re-initialization. Ensures a fresh list of manufacturers is displayed each time defaults are restored. --- .../FFUUI.Core/FFUUI.Core.Initialize.psm1 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 index 376700e..0870af7 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 @@ -322,11 +322,15 @@ function Initialize-UIDefaults { # Drivers tab UI logic $makeList = @('Microsoft', 'Dell', 'HP', 'Lenovo') - foreach ($m in $makeList) { - [void]$State.Controls.cmbMake.Items.Add($m) - } - if ($State.Controls.cmbMake.Items.Count -gt 0) { - $State.Controls.cmbMake.SelectedIndex = 0 + if ($null -ne $State.Controls.cmbMake) { + # Clear existing items to prevent duplication on re-initialization (e.g., after Restore Defaults) + $State.Controls.cmbMake.Items.Clear() + foreach ($m in $makeList) { + [void]$State.Controls.cmbMake.Items.Add($m) + } + if ($State.Controls.cmbMake.Items.Count -gt 0) { + $State.Controls.cmbMake.SelectedIndex = 0 + } } Update-DriverDownloadPanelVisibility -State $State