Fixed crash with SetNpadMode

fixed crash due to handheld
This commit is contained in:
David Marcec 2018-12-03 02:45:08 +11:00
parent 7ce17b2cf6
commit a9223c8182

View File

@ -518,8 +518,9 @@ Controller_NPad::NpadHoldType Controller_NPad::GetHoldType() const {
} }
void Controller_NPad::SetNpadMode(u32 npad_id, NPadAssignments assignment_mode) { void Controller_NPad::SetNpadMode(u32 npad_id, NPadAssignments assignment_mode) {
ASSERT(npad_id < shared_memory_entries.size()); const std::size_t npad_index = NPadIdToIndex(npad_id);
shared_memory_entries[npad_id].pad_assignment = assignment_mode; ASSERT(npad_index < shared_memory_entries.size());
shared_memory_entries[npad_index].pad_assignment = assignment_mode;
} }
void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids, void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,