Skip to content

Commit 05c5c3d

Browse files
Merge pull request #138 from wendelinwemhoener/disallow-empty-flashcards
Disallow creating empty flashcards
2 parents 138bcf3 + 435c297 commit 05c5c3d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

data/flashcards/flashcard.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
7 | Hello | Duke | 5
44
9 | id | checker | 5
55
10 | id increases | correctly | 5
6+
11 | f | dfdf | 5

src/main/java/seedu/duke/flashcard/command/CreateFlashcardCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public class CreateFlashcardCommand extends FlashcardCommand {
2323
public void execute(Scanner scanner, FlashcardList flashcardList) {
2424
System.out.print(" Enter the front page text: ");
2525
String frontPageText = scanner.nextLine();
26+
27+
while (frontPageText.strip().equals("")) {
28+
System.out.println(" Invalid input! The front text must " +
29+
"contain at least one letter or digit!");
30+
31+
System.out.print(" Enter the front page text: ");
32+
frontPageText = scanner.nextLine();
33+
}
34+
2635
System.out.print(" Enter the back page text: ");
2736
String backPageText = scanner.nextLine();
2837

0 commit comments

Comments
 (0)