diff --git a/src/Common/Win32/XBController.cpp b/src/Common/Win32/XBController.cpp index cef1f6280..fc6913781 100644 --- a/src/Common/Win32/XBController.cpp +++ b/src/Common/Win32/XBController.cpp @@ -1085,6 +1085,11 @@ void XBController::ReorderObjects(const char *szDeviceName, int pos) { old = v; break; + } else { + // If old device name was not found, do not continue + // int old will equal -1, which leads to an out-of-bounds + // memory access below + return; } }