Skip to content

Commit 09d258e

Browse files
Fix Calenadr periods list max size
1 parent 7349879 commit 09d258e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/clusters/energy-calendar-server/energy-calendar-server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ CHIP_ERROR CalendarProvider::SetPeakPeriods(DataModel::Nullable<Structs::PeakPer
277277
bool CalendarProvider::CheckPeriods(DataModel::List<Structs::CalendarPeriodStruct::Type> &periods)
278278
{
279279
uint32_t date = 0;
280-
VerifyOrReturnLogSend((periods.size() > 0 || periods.size() <= 4), mEndpoint, "Periods list size must be from 1 to 4");
280+
VerifyOrReturnLogSend((periods.size() > 0 && periods.size() <= 4), mEndpoint, "Periods list size must be from 1 to 4");
281281
for (auto & period : periods)
282282
{
283283
if (!period.startDate.IsNull())
@@ -326,7 +326,7 @@ bool CalendarProvider::CheckDay(const Structs::DayStruct::Type & day)
326326
VerifyOrReturnLogSend(!day.daysOfWeek.HasValue() || !day.date.HasValue(), mEndpoint,
327327
"Day can have only one value or DayOfWeek or Date");
328328

329-
VerifyOrReturnLogSend((day.transitions.size() > 0 || day.transitions.size() <= 48), mEndpoint,
329+
VerifyOrReturnLogSend((day.transitions.size() > 0 && day.transitions.size() <= 48), mEndpoint,
330330
"Day transinions list must have from 1 to 48 records");
331331

332332
uint32_t time = 0;

0 commit comments

Comments
 (0)