java.lang.NullPointerException: Cannot invoke "String.substring(int, int)" because "word" is null