Skip to content

Commit

Permalink
add null check to SetSearchKeySingle in nn_olv_PostTypes.h
Browse files Browse the repository at this point in the history
Updated SetSearchKey function to handle null search keys. If a null search key is provided, the function now clears the search key at the specified index and returns success.
  • Loading branch information
Squall-Leonhart committed Sep 22, 2023
1 parent b4aa10b commit 5295cc1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Cafe/OS/libs/nn_olv/nn_olv_PostTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ namespace nn
// SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCwUc
static nnResult SetSearchKey(DownloadPostDataListParam* _this, const uint16be* searchKey, uint8 searchKeyIndex)
{
if( !searchKey )
{
memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey));
return OLV_RESULT_SUCCESS;
}
if (searchKeyIndex >= MAX_NUM_SEARCH_KEY)
return OLV_RESULT_INVALID_PARAMETER;
memset(&_this->searchKeyArray[searchKeyIndex], 0, sizeof(SearchKey));
Expand Down

0 comments on commit 5295cc1

Please sign in to comment.