From aa38a6aaa5158c1cb329b3ed87b392abee327f12 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Thu, 12 Mar 2020 18:42:48 +0000 Subject: [PATCH] 98_WeekdayTimer.pm: bugfix to prevent FHEM crash, #109164 git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@21412 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_WeekdayTimer.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/FHEM/98_WeekdayTimer.pm b/FHEM/98_WeekdayTimer.pm index 8741555e2..754093782 100644 --- a/FHEM/98_WeekdayTimer.pm +++ b/FHEM/98_WeekdayTimer.pm @@ -4,7 +4,7 @@ # 98_WeekdayTimer.pm # written by Dietmar Ortmann # modified by Tobias Faust -# Maintained by igami since 02-2018 +# Maintained by Beta-User since 11-2019 # Thanks Dietmar for all you did for FHEM, RIP # # This file is part of fhem. @@ -978,6 +978,11 @@ sub WeekdayTimer_FensterOffen ($$$) { my $nextRetry = time()+55+int(rand(10)); my $epoch = $hash->{profil}{$time}{EPOCH}; + unless ($epoch) { #prevent FHEM crashing when profile is somehow damaged or incomlete, forum #109164 + my $actual_wp_reading = ReadingsVal($name,"weekprofiles","none"); + Log3 $hash, 0, "[$name] profile $actual_wp_reading, item $time seems to be somehow damaged or incomlete!"; + $epoch = int(time()) - 10*MINUTESECONDS; + } my $delay = int(time()) - $epoch; my $nextDelay = int($delay/60.+1.5)*60; # round to multiple of 60sec $nextRetry = $epoch + $nextDelay;