mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 13:29:26 +00:00
98_weekprofile: dry fix crash msg407302
git-svn-id: https://svn.fhem.de/fhem/trunk@10829 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d2f3f60c0c
commit
4dd4a2a887
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user