Skip to content

Commit

Permalink
Patch to fix chipdie on no value for nominalPower
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Aug 14, 2024
1 parent f5f27b4 commit 6f626e2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
const Structs::SlotAdjustmentStruct::Type & slotAdjustment = iterator.GetValue();

// Check for an invalid slotIndex
if (slotAdjustment.slotIndex > forecast.Value().slots.size())
if (slotAdjustment.slotIndex >= forecast.Value().slots.size())
{
ChipLogError(Zcl, "DEM: Bad slot index %d", slotAdjustment.slotIndex);
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
Expand All @@ -697,6 +697,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
if (HasFeature(Feature::kPowerForecastReporting))
{
if (!slot.minPowerAdjustment.HasValue() || !slot.maxPowerAdjustment.HasValue() ||
!slotAdjustment.nominalPower.HasValue() ||
slotAdjustment.nominalPower.Value() < slot.minPowerAdjustment.Value() ||
slotAdjustment.nominalPower.Value() > slot.maxPowerAdjustment.Value())
{
Expand Down

0 comments on commit 6f626e2

Please sign in to comment.