Fixed return values and NULL objects for OutOfRange comparison

This commit is contained in:
Lord Hepipud 2019-07-22 13:15:21 +02:00
parent e9583382f5
commit c82bdad7cc

View file

@ -41,7 +41,7 @@ function New-IcingaCheck()
param($warning);
if ([string]::IsNullOrEmpty($warning)) {
return;
return $this;
}
if ((Test-Numeric $warning)) {
@ -223,6 +223,10 @@ function New-IcingaCheck()
$Check | Add-Member -membertype ScriptMethod -name 'CritOutOfRange' -value {
param($critical);
if ([string]::IsNullOrEmpty($critical)) {
return $this;
}
if ((Test-Numeric $critical)) {
$this.CritIfGreaterThan($critical).CritIfLowerThan(0) | Out-Null;
} else {