From 22714b536d4ad7d6b4e0b48205418c29db767b82 Mon Sep 17 00:00:00 2001 From: Rephl3x Date: Thu, 29 Jan 2026 10:11:10 +1300 Subject: [PATCH] Guard Update-ReplicationUI calls --- certy.ps1 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/certy.ps1 b/certy.ps1 index 7bbb949..f26a7ed 100644 --- a/certy.ps1 +++ b/certy.ps1 @@ -679,6 +679,15 @@ function Update-OutputTypeUI { } } +function Update-ReplicationUI { + $enabled = $replicationEnabledBox.Checked + $replicationTargetsBox.Enabled = $enabled + $replicationFromSelectedBtn.Enabled = $enabled + $primaryFromSelectedBtn.Enabled = $enabled + $replicationCmdBox.Enabled = $enabled + $dnsListBox.Enabled = $enabled +} + $loadedDefaults = Load-Defaults if ($loadedDefaults) { if ($loadedDefaults.DefaultZone) { $zoneBox.Text = $loadedDefaults.DefaultZone } @@ -702,7 +711,7 @@ if ($loadedDefaults) { if ($loadedDefaults.OutputType) { $outputTypeBox.SelectedItem = $loadedDefaults.OutputType } if (-not $outputTypeBox.SelectedItem) { $outputTypeBox.SelectedIndex = 0 } Update-OutputTypeUI - Update-ReplicationUI + if (Test-Path function:Update-ReplicationUI) { Update-ReplicationUI } & $logAction "Defaults loaded from $(Get-DefaultsPath)." } @@ -747,15 +756,6 @@ function Apply-Layout { $saveDefaultsBtn.Left = $clearBtn.Left + $clearBtn.Width + $buttonGap } -function Update-ReplicationUI { - $enabled = $replicationEnabledBox.Checked - $replicationTargetsBox.Enabled = $enabled - $replicationFromSelectedBtn.Enabled = $enabled - $primaryFromSelectedBtn.Enabled = $enabled - $replicationCmdBox.Enabled = $enabled - $dnsListBox.Enabled = $enabled -} - $browseBtn.Add_Click({ $dialog = New-Object System.Windows.Forms.OpenFileDialog $dialog.Filter = "Text/CSV files (*.txt;*.csv)|*.txt;*.csv|All files (*.*)|*.*" @@ -773,7 +773,7 @@ $browseBtn.Add_Click({ }) $replicationEnabledBox.Add_CheckedChanged({ - Update-ReplicationUI + if (Test-Path function:Update-ReplicationUI) { Update-ReplicationUI } }) $filePreviewBtn.Add_Click({