Skip to content

Commit 6150e20

Browse files
Merge pull request KelvinTegelaar#1635 from PeterVive/intune-comparison-nullvalues
Add proper null checks to handle "0" values not being evaluated as false.
2 parents 99ccfd6 + 030a150 commit 6150e20

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Modules/CIPPCore/Public/Compare-CIPPIntuneObject.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ function Compare-CIPPIntuneObject {
244244
$child.choiceSettingValue.value
245245
}
246246
}
247+
if (!$childValue -and $null -ne $child.simpleSettingValue -and $null -ne $child.simpleSettingValue.value) {
248+
$childValue = $child.simpleSettingValue.value
249+
}
247250

248251
# Add object to our temporary list
249252
[PSCustomObject]@{
@@ -337,9 +340,9 @@ function Compare-CIPPIntuneObject {
337340
} else {
338341
$child.choiceSettingValue.value
339342
}
340-
if (!$childValue -and $child.simpleSettingValue.value) {
341-
$childValue = $child.simpleSettingValue.value
342-
}
343+
}
344+
if (!$childValue -and $null -ne $child.simpleSettingValue -and $null -ne $child.simpleSettingValue.value) {
345+
$childValue = $child.simpleSettingValue.value
343346
}
344347

345348
# Add object to our temporary list

0 commit comments

Comments
 (0)