mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-07-02 22:58:34 +00:00
Guard against loading, saving & executing undefined features (#665)
This commit is contained in:
@@ -242,6 +242,10 @@ $script:Features = @{}
|
||||
try {
|
||||
$featuresData = Get-Content -Path $script:FeaturesFilePath -Raw | ConvertFrom-Json
|
||||
foreach ($feature in $featuresData.Features) {
|
||||
if ([string]::IsNullOrWhiteSpace([string]$feature.FeatureId) -or [string]::IsNullOrWhiteSpace([string]$feature.Label) -or [string]::IsNullOrWhiteSpace([string]$feature.ApplyText)) {
|
||||
Write-Warning "Feature '$($feature.FeatureId)' is missing a FeatureId, Label, or ApplyText in Features.json and will be skipped."
|
||||
continue
|
||||
}
|
||||
$script:Features[$feature.FeatureId] = $feature
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user