mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-07-03 07:08:27 +00:00
Guard against loading, saving & executing undefined features (#665)
This commit is contained in:
@@ -21,6 +21,9 @@ function LoadSettings {
|
||||
|
||||
$feature = $script:Features[$setting.Name]
|
||||
|
||||
# Skip unknown settings that aren't defined in Features.json
|
||||
if (-not $feature) { continue }
|
||||
|
||||
# Check version and feature compatibility using Features.json
|
||||
if (($feature.MinVersion -and $WinVersion -lt $feature.MinVersion) -or ($feature.MaxVersion -and $WinVersion -gt $feature.MaxVersion) -or ($feature.FeatureId -eq 'DisableModernStandbyNetworking' -and (-not $script:ModernStandbySupported))) {
|
||||
continue
|
||||
|
||||
@@ -11,7 +11,7 @@ function SaveSettings {
|
||||
}
|
||||
|
||||
foreach ($param in $script:Params.Keys) {
|
||||
if ($script:ControlParams -notcontains $param) {
|
||||
if ($script:ControlParams -notcontains $param -and $script:Features.ContainsKey($param)) {
|
||||
$value = $script:Params[$param]
|
||||
|
||||
$settings.Settings += @{
|
||||
|
||||
Reference in New Issue
Block a user