From 80e2b3dd14e95787c6a4ca79a9788e1b7b16ee66 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Mon, 28 Dec 2020 17:02:32 +0100 Subject: [PATCH] fix new time matching if QTime is not initialized --- src/headers/switch-time.hpp | 2 +- src/switch-time.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/headers/switch-time.hpp b/src/headers/switch-time.hpp index b9692bad..888db150 100644 --- a/src/headers/switch-time.hpp +++ b/src/headers/switch-time.hpp @@ -20,7 +20,7 @@ typedef enum { struct TimeSwitch : SceneSwitcherEntry { timeTrigger trigger = ANY_DAY; - QTime time = QTime(); + QTime time = QTime(0, 0); const char *getType() { return "time"; } diff --git a/src/switch-time.cpp b/src/switch-time.cpp index 4b64a542..b513ad2c 100644 --- a/src/switch-time.cpp +++ b/src/switch-time.cpp @@ -74,6 +74,9 @@ void AdvSceneSwitcher::on_timeDown_clicked() bool timesAreInInterval(QTime &time1, QTime &time2, int &interval) { + if (time1.isNull() || time2.isNull()) + return false; + bool ret = false; QTime validSwitchTimeWindow = time1.addMSecs(interval);