Prevent infinity loop if a character is the input