Bugfix for issue #3: In checkValidityOfQuestion(), check length of string before attempting to do a substring on it.