Enhance the rangeCheck() method to ensure the nSelectedIndex being set is in range against the available list of options.