I did not encounter this problem until I implemented scanning for mouse position and converting mPosX to the index of an array, which has been plotted. When I roll mouse to the edge, program crashes with "out of range" error. It happens with GetMouseState(), before I even implement the conversions.