Check the validity of the index being passed.

To stop people shooting themselves in the foot with a loaded shotgun.