Compare-Object on $null array
if($Value1 -eq $NULL){
return
}
Compare-Object -ReferenceObject $Value1 -DifferenceObject $Value2
This accepts null values:
Compare-Object -ReferenceObject @($Value1 | Select-Object) -DifferenceObject @($Value2 | Select-Object)
Help on Compare-object says:
If the reference set or the difference set is null ($null), Compare-Object generates a terminating error.
So your only options would seem to be a trap or try/catch.