From a9223c81820701971017e672fbb9ca065e560f7c Mon Sep 17 00:00:00 2001 From: David Marcec Date: Mon, 3 Dec 2018 02:45:08 +1100 Subject: Fixed crash with SetNpadMode fixed crash due to handheld --- src/core/hle/service/hid/controllers/npad.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service/hid/controllers') diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 22e87a50a..b49e34594 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -518,8 +518,9 @@ Controller_NPad::NpadHoldType Controller_NPad::GetHoldType() const { } void Controller_NPad::SetNpadMode(u32 npad_id, NPadAssignments assignment_mode) { - ASSERT(npad_id < shared_memory_entries.size()); - shared_memory_entries[npad_id].pad_assignment = assignment_mode; + const std::size_t npad_index = NPadIdToIndex(npad_id); + ASSERT(npad_index < shared_memory_entries.size()); + shared_memory_entries[npad_index].pad_assignment = assignment_mode; } void Controller_NPad::VibrateController(const std::vector& controller_ids, -- cgit v1.2.3