Skip to content

Commit

Permalink
Use default country code in QueryImage if the local value is corrupted (
Browse files Browse the repository at this point in the history
  • Loading branch information
selissia authored and pull[bot] committed Feb 13, 2024
1 parent de9bb53 commit 2016866
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/clusters/ota-requestor/OTARequestor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,13 @@ CHIP_ERROR OTARequestor::SendQueryImageRequest(OperationalDeviceProxy & devicePr

char location[DeviceLayer::ConfigurationManager::kMaxLocationLength];
size_t codeLen = 0;
if ((DeviceLayer::ConfigurationMgr().GetCountryCode(location, sizeof(location), codeLen) == CHIP_NO_ERROR) && (codeLen > 0))
if ((DeviceLayer::ConfigurationMgr().GetCountryCode(location, sizeof(location), codeLen) == CHIP_NO_ERROR) && (codeLen == 2))
{
args.location.SetValue(CharSpan(location, codeLen));
}
else
{
// Country code unavailable or invalid, use default
args.location.SetValue(CharSpan("XX", strlen("XX")));
}

Expand Down

0 comments on commit 2016866

Please sign in to comment.