mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
57_Calendar: one more code line hardened against non-existent start or end times; evaluate error message returned from HttpUtils
git-svn-id: https://svn.fhem.de/fhem/trunk@6661 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c9155bc293
commit
8c6a06f94a
@ -639,7 +639,9 @@ sub isEnded {
|
||||
|
||||
sub nextTime {
|
||||
my ($self,$t) = @_;
|
||||
my @times= ( $self->{start}, $self->{end} );
|
||||
my @times= ( );
|
||||
push @times, $self->{start} if(defined($self->{start}));
|
||||
push @times, $self->{end} if(defined($self->{end}));
|
||||
unshift @times, $self->{alarm} if($self->{alarm});
|
||||
@times= sort grep { $_ > $t } @times;
|
||||
|
||||
@ -880,11 +882,12 @@ sub Calendar_GetUpdate($$) {
|
||||
my $type = $hash->{fhem}{type};
|
||||
my $url= $hash->{fhem}{url};
|
||||
|
||||
my $errmsg= "";
|
||||
my $ics;
|
||||
|
||||
if($type eq "url"){
|
||||
#$ics= GetFileFromURLQuiet($url,10,undef,0,5) if($type eq "url");
|
||||
$ics= HttpUtils_BlockingGet( { url => $url, hideurl => 1, timeout => 10, } );
|
||||
($errmsg, $ics)= HttpUtils_BlockingGet( { url => $url, hideurl => 1, timeout => 10, } );
|
||||
} elsif($type eq "file") {
|
||||
if(open(ICSFILE, $url)) {
|
||||
while(<ICSFILE>) {
|
||||
@ -901,8 +904,8 @@ sub Calendar_GetUpdate($$) {
|
||||
}
|
||||
|
||||
|
||||
if(!defined($ics) or ("$ics" eq "")) {
|
||||
Log3 $hash, 1, "Calendar " . $hash->{NAME} . ": Could not retrieve file at URL";
|
||||
if(!defined($ics) or ("$ics" eq "") or ($errmsg ne "")) {
|
||||
Log3 $hash, 1, "Calendar " . $hash->{NAME} . ": Could not retrieve file at URL. $errmsg";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user