From c82bdad7cc3a1aa88583a3a65d5d475a785abc8f Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Mon, 22 Jul 2019 13:15:21 +0200 Subject: [PATCH] Fixed return values and NULL objects for OutOfRange comparison --- lib/icinga/plugin/New-IcingaCheck.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/icinga/plugin/New-IcingaCheck.psm1 b/lib/icinga/plugin/New-IcingaCheck.psm1 index 9e7dcfe..019b0d5 100644 --- a/lib/icinga/plugin/New-IcingaCheck.psm1 +++ b/lib/icinga/plugin/New-IcingaCheck.psm1 @@ -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 {