Bounds-check button number before recording in buttonsDown.