Added bounds checking to the scanner current method.