98_WeekdayTimer, 98_Heating_Control: issue http://forum.fhem.de/index.php/topic,46312.0.html fixed.

no crash anymore when using a wrong definition name

git-svn-id: https://svn.fhem.de/fhem/trunk@10430 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dietmar63 2016-01-09 18:33:25 +00:00
parent e2041662c1
commit 36b9cdbc69

View File

@ -141,7 +141,6 @@ sub WeekdayTimer_Define($$) {
WeekdayTimer_GlobalDaylistSpec ($hash, \@a); WeekdayTimer_GlobalDaylistSpec ($hash, \@a);
$hash->{TYPE} = $type;
$hash->{NAME} = $name; $hash->{NAME} = $name;
$hash->{DEVICE} = $device; $hash->{DEVICE} = $device;
@ -416,11 +415,11 @@ sub WeekdayTimer_gatherSwitchingTimes {
#pruefen auf Angabe eines Schaltpunktes #pruefen auf Angabe eines Schaltpunktes
my $element = ""; my $element = "";
my @restoreElemets = (); my @restoreElements = ();
E: while (@$a > 0) { E: while (@$a > 0) {
my $actualElement = shift @$a; my $actualElement = shift @$a;
push @restoreElemets, $actualElement; push @restoreElements, $actualElement;
$element = $element . $actualElement . " "; $element = $element . $actualElement . " ";
Log3 $hash, 5, "[$name] $element - trying to accept as a switchtime"; Log3 $hash, 5, "[$name] $element - trying to accept as a switchtime";
@ -447,6 +446,8 @@ E: while (@$a > 0) {
last; last;
} }
# ein space am Ende wieder abschneiden
$element = substr ($element, 0, length($element)-1);
my @t = split(/\|/, $element); my @t = split(/\|/, $element);
my $anzahl = @t; my $anzahl = @t;
if ( $anzahl >= 2 && $anzahl <= 3) { if ( $anzahl >= 2 && $anzahl <= 3) {
@ -454,7 +455,7 @@ E: while (@$a > 0) {
push(@switchingtimes, $element); push(@switchingtimes, $element);
} else { } else {
Log3 $hash, 4, "[$name] $element - NOT accepted, must be command or condition"; Log3 $hash, 4, "[$name] $element - NOT accepted, must be command or condition";
unshift @$a, @restoreElemets; unshift @$a, @restoreElements;
last; last;
} }
} }