Skip to content

Commit

Permalink
nn_olv: Handle nullptr key in SetSearchKey (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
Squall-Leonhart authored Sep 22, 2023
1 parent b4aa10b commit 638c401
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 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 All @@ -546,6 +551,11 @@ namespace nn
// SetSearchKey__Q3_2nn3olv25DownloadPostDataListParamFPCw
static nnResult SetSearchKeySingle(DownloadPostDataListParam* _this, const uint16be* searchKey)
{
if (searchKey == nullptr)
{
cemuLog_logDebug(LogType::NN_OLV, "DownloadPostDataListParam::SetSearchKeySingle: searchKeySingle is Null\n");
return OLV_RESULT_INVALID_PARAMETER;
}
return SetSearchKey(_this, searchKey, 0);
}

Expand Down

0 comments on commit 638c401

Please sign in to comment.