98_weekprofile: dry fix crash msg407302

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10829 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
risiko79
2016-02-14 10:12:42 +00:00
parent 8704b3dd59
commit 003f230c37

View File

@@ -256,7 +256,7 @@ sub weekprofile_sendDevProfile(@)
$k++;
}
}
my $ret = undef;
if ($cmd) {
$cmd =~ s/^\s+|\s+$//g;
@@ -464,13 +464,15 @@ sub weekprofile_Get($$@)
my ($topic, $name) = weekprofile_splitName($params[0]);
my ($prf,$idx) = weekprofile_findPRF($hash,$name,$topic);
return "profile $params[0] not found" unless ($prf);
return "profile $params[0] not found" if (!defined($prf));
if (defined($prf->{REF})) {
($topic, $name) = weekprofile_splitName($prf->{REF});
($prf,$idx) = weekprofile_findPRF($hash,$name,$topic);
}
return "profile $params[0] has no data" if (!defined($prf->{DATA}));
my $json = JSON->new;
my $json_text = $json->encode($prf->{DATA});
return $json_text;