[monitoring-plugins] Fix tests with an empty NPTest.cache file

Git Repository git at monitoring-plugins.org
Sun Jan 26 11:00:07 CET 2014


 Module: monitoring-plugins
 Branch: master
 Commit: 754cd092aea7d0f45f02c4fa695c827f7e81c5b2
 Author: Thomas Guyot-Sionnest <dermoth at aei.ca>
   Date: Sun Jan 26 04:49:32 2014 -0500
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=754cd09

Fix tests with an empty NPTest.cache file

The NPTest.cache cannot be loaded when empty, and this prevents
getting the data and populating the file. This patch skips the file when
empty as if it didn't exist.

---

 NPTest.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NPTest.pm b/NPTest.pm
index b00a708..3d6e3a2 100644
--- a/NPTest.pm
+++ b/NPTest.pm
@@ -438,7 +438,7 @@ sub LoadCache
 
     chomp($fileContents);
     my( $contentsRef ) = eval $fileContents;
-    %CACHE = %{$contentsRef};
+    %CACHE = %{$contentsRef} if (defined($contentsRef));
 
   }
 



More information about the Commits mailing list