Skip to content

Commit

Permalink
Return RESOURCE_EXHAUSTED if we fail to get number of presets support…
Browse files Browse the repository at this point in the history
…ed from the delegate
  • Loading branch information
nivi-apple committed Aug 23, 2024
1 parent f776c5d commit 3826af1
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,7 @@ CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Thermostat::Delegate * dele

uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets();

if (numberOfPresetsSupported == 0)
{
ChipLogError(Zcl, "AppendPendingPreset: Failed to get NumberOfPresets");
return CHIP_IM_GLOBAL_STATUS(InvalidInState);
}

if (totalExpectedCount > numberOfPresetsSupported)
if (numberOfPresetsSupported == 0 || totalExpectedCount > numberOfPresetsSupported)
{
return CHIP_IM_GLOBAL_STATUS(ResourceExhausted);
}
Expand Down

0 comments on commit 3826af1

Please sign in to comment.