From e8dce7f4c49c37a299b23ad08e4a74ee4d64913b Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Tue, 30 Dec 2014 07:48:22 +0000 Subject: [PATCH] 99_Utils.pm: return undef,undef, if key was not found (Forum #30528) git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7364 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/99_Utils.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/99_Utils.pm b/fhem/FHEM/99_Utils.pm index ae41d7c5b..bccbd8309 100644 --- a/fhem/FHEM/99_Utils.pm +++ b/fhem/FHEM/99_Utils.pm @@ -16,7 +16,7 @@ sub getUniqueId() { my ($err, $uniqueID) = getKeyValue("uniqueID"); - return $uniqueID if(!$err); + return $uniqueID if(defined($uniqueID)); srand(time); $uniqueID = join "",map { unpack "H*", chr(rand(256)) } 1..16; setKeyValue("uniqueID", $uniqueID); @@ -33,7 +33,7 @@ getKeyValue($) for my $l (@l) { return (undef, $1) if($l =~ m/^$key:(.*)/); } - return ("Key not found", undef); + return (undef, undef); } sub @@ -404,7 +404,8 @@ myUtils_Initialize($$)
  • getKeyValue(keyName)
    return ($error, $value), stored previously by setKeyValue. - $error is undef if there was no error, otherwise $value is undef. + $error is set if there was an error. Both are undef, if there is no + value yet for this key.