Skip to content

Commit

Permalink
Merge pull request #160 from ivanderjmw/Ivander-fix-LoadTrip-Bug
Browse files Browse the repository at this point in the history
fix Load trip bug.
  • Loading branch information
ivanderjmw authored Nov 9, 2020
2 parents 3eba4d0 + 314704e commit 15ab960
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/seedu/trippie/command/LoadTripCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public void execute(Ui ui, TrippieData trippieData) {
try {
System.out.print("Which one do you want to load? Enter the index:");
index = Integer.parseInt(ui.getLine());

if (index <= 0) {
throw new IndexOutOfBoundsException();
}

trippieData.setCurrentTripFromIndex(index - 1);
trippieData.loadCurrentTripFromFile();
} catch (NumberFormatException e) {
Expand Down

0 comments on commit 15ab960

Please sign in to comment.