mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 21:40:05 +00:00
Add missing sanity checks to quitTask and useItem
This commit is contained in:
parent
609d3cdb99
commit
f3b9ecd791
@ -233,8 +233,8 @@ void ItemManager::itemUseHandler(CNSocket* sock, CNPacketData* data) {
|
|||||||
sP_CL2FE_REQ_ITEM_USE* request = (sP_CL2FE_REQ_ITEM_USE*)data->buf;
|
sP_CL2FE_REQ_ITEM_USE* request = (sP_CL2FE_REQ_ITEM_USE*)data->buf;
|
||||||
Player* player = PlayerManager::getPlayer(sock);
|
Player* player = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
if (player == nullptr)
|
if (player == nullptr || request->iSlotNum < 0 || request->iSlotNum >= AINVEN_COUNT)
|
||||||
return;
|
return; // sanity check
|
||||||
|
|
||||||
// gumball can only be used from inventory, so we ignore eIL
|
// gumball can only be used from inventory, so we ignore eIL
|
||||||
sItemBase gumball = player->Inven[request->iSlotNum];
|
sItemBase gumball = player->Inven[request->iSlotNum];
|
||||||
|
@ -229,8 +229,8 @@ void MissionManager::quitMission(CNSocket* sock, CNPacketData* data) {
|
|||||||
void MissionManager::quitTask(CNSocket* sock, int32_t taskNum, bool manual) {
|
void MissionManager::quitTask(CNSocket* sock, int32_t taskNum, bool manual) {
|
||||||
Player* plr = PlayerManager::getPlayer(sock);
|
Player* plr = PlayerManager::getPlayer(sock);
|
||||||
|
|
||||||
if (plr == nullptr)
|
if (plr == nullptr || Tasks.find(taskNum) == Tasks.end())
|
||||||
return;
|
return; // sanity check
|
||||||
|
|
||||||
// update player
|
// update player
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user