File tree 1 file changed +5
-4
lines changed
src/app/clusters/time-synchronization-server
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -551,9 +551,9 @@ CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList
551
551
552
552
if (lastTzState != TimeState::kInvalid )
553
553
{
554
- const auto & tzStore = GetTimeZone ()[0 ];
555
- lastTz.offset = tzStore.timeZone .offset ;
556
- if (tzStore.timeZone .name .HasValue ())
554
+ const TimeSyncDataProvider::TimeZoneStore & tzStore = GetTimeZone ()[0 ];
555
+ lastTz.offset = tzStore.timeZone .offset ;
556
+ if (tzStore.timeZone .name .HasValue () && sizeof (name) >= sizeof (tzStore. name ) )
557
557
{
558
558
lastTz.name .SetValue (CharSpan (name));
559
559
memcpy (name, tzStore.name , sizeof (tzStore.name ));
@@ -623,7 +623,8 @@ CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList
623
623
{
624
624
emit = true ;
625
625
}
626
- if ((tz.name .HasValue () && lastTz.name .HasValue ()) && !(tz.name .Value ().data_equal (lastTz.name .Value ())))
626
+ if (tz.name .HasValue () != lastTz.name .HasValue () ||
627
+ ((tz.name .HasValue () && lastTz.name .HasValue ()) && !(tz.name .Value ().data_equal (lastTz.name .Value ()))))
627
628
{
628
629
emit = true ;
629
630
}
You can’t perform that action at this time.
0 commit comments