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:
@@ -464,13 +464,15 @@ sub weekprofile_Get($$@)
|
|||||||
my ($topic, $name) = weekprofile_splitName($params[0]);
|
my ($topic, $name) = weekprofile_splitName($params[0]);
|
||||||
|
|
||||||
my ($prf,$idx) = weekprofile_findPRF($hash,$name,$topic);
|
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})) {
|
if (defined($prf->{REF})) {
|
||||||
($topic, $name) = weekprofile_splitName($prf->{REF});
|
($topic, $name) = weekprofile_splitName($prf->{REF});
|
||||||
($prf,$idx) = weekprofile_findPRF($hash,$name,$topic);
|
($prf,$idx) = weekprofile_findPRF($hash,$name,$topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "profile $params[0] has no data" if (!defined($prf->{DATA}));
|
||||||
|
|
||||||
my $json = JSON->new;
|
my $json = JSON->new;
|
||||||
my $json_text = $json->encode($prf->{DATA});
|
my $json_text = $json->encode($prf->{DATA});
|
||||||
return $json_text;
|
return $json_text;
|
||||||
|
|||||||
Reference in New Issue
Block a user