Skip to content

Commit 470c7d1

Browse files
Merge pull request #322 from UncleGrandpa925/implement-additional-features-v1.4
Fix a bug in parseLessonDateTime that crash the app
2 parents 35c8471 + 64861b3 commit 470c7d1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/trackitnus/logic/parser/ParserUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ public static LessonDateTime parseLessonDateTime(String date) throws ParseExcept
302302
}
303303
String[] startEndTime = tokens[1].split("-", 2);
304304
DayOfWeek weekday = parseLessonWeekday(tokens[0]);
305+
if (startEndTime.length != 2) {
306+
throw new ParseException(LessonDateTime.MESSAGE_CONSTRAINTS);
307+
}
305308
LocalTime startTime = LocalTime.parse(startEndTime[0], LessonDateTime.FORMATTER);
306309
LocalTime endTime = LocalTime.parse(startEndTime[1], LessonDateTime.FORMATTER);
307310
if (startTime.compareTo(endTime) >= 0) {

0 commit comments

Comments
 (0)