diff --git a/editor/opening_hours_ui.cpp b/editor/opening_hours_ui.cpp index 34215f7eaf..b924063eaa 100644 --- a/editor/opening_hours_ui.cpp +++ b/editor/opening_hours_ui.cpp @@ -305,9 +305,10 @@ TOpeningDays TimeTableSet::GetUnhandledDays() const TimeTable TimeTableSet::GetComplementTimeTable() const { - TimeTable tt; + TimeTable tt = TimeTable::GetUninitializedTimeTable(); // Set predefined opening time before set 24 hours, otherwise // it has no effect. + tt.SetTwentyFourHours(false); tt.SetOpeningTime(tt.GetPredefinedOpeningTime()); tt.SetTwentyFourHours(true); tt.SetOpeningDays(GetUnhandledDays()); diff --git a/editor/opening_hours_ui.hpp b/editor/opening_hours_ui.hpp index c80e254006..ba95d5d4c7 100644 --- a/editor/opening_hours_ui.hpp +++ b/editor/opening_hours_ui.hpp @@ -15,6 +15,7 @@ using TOpeningDays = set; class TimeTable { public: + static TimeTable GetUninitializedTimeTable() { return {}; } static TimeTable GetPredefinedTimeTable(); bool IsTwentyFourHours() const { return m_isTwentyFourHours; } @@ -41,6 +42,8 @@ public: osmoh::Timespan GetPredefinedExcludeTime() const; private: + TimeTable() = default; + bool m_isTwentyFourHours; TOpeningDays m_weekdays; osmoh::Timespan m_openingTime; diff --git a/editor/ui2oh.cpp b/editor/ui2oh.cpp index e2338332b8..e7085bfb93 100644 --- a/editor/ui2oh.cpp +++ b/editor/ui2oh.cpp @@ -188,7 +188,7 @@ bool MakeTimeTableSet(osmoh::OpeningHours const & oh, ui::TimeTableSet & tts) bool first = true; for (auto const & rulePart : oh.GetRule()) { - ui::TimeTable tt; + ui::TimeTable tt = ui::TimeTable::GetUninitializedTimeTable(); tt.SetOpeningTime(tt.GetPredefinedOpeningTime()); // TODO(mgsergio): We don't handle cases with speciffic time off.