Added Invalid Request Drop to AchievementManager Request

This fixes a crash I found in the Request function of AchievementManager where under certain conditions init_request would return an api_request with null post data, and Post would crash if it attempted to access it. Now the function aborts before the Post and returns an INVALID_REQUEST response type.
This commit is contained in:
LillyJadeKatrin 2023-04-29 00:05:32 -04:00
parent 8e6e6f3c4a
commit 9778640a84
2 changed files with 3 additions and 0 deletions

View File

@ -384,6 +384,8 @@ AchievementManager::ResponseType AchievementManager::Request(
rc_api_request_t api_request;
Common::HttpRequest http_request;
init_request(&api_request, &rc_request);
if (!api_request.post_data)
return ResponseType::INVALID_REQUEST;
auto http_response = http_request.Post(api_request.url, api_request.post_data);
rc_api_destroy_request(&api_request);
if (http_response.has_value() && http_response->size() > 0)

View File

@ -26,6 +26,7 @@ public:
{
SUCCESS,
MANAGER_NOT_INITIALIZED,
INVALID_REQUEST,
INVALID_CREDENTIALS,
CONNECTION_FAILED,
UNKNOWN_FAILURE