diff --git a/src/Text.java b/src/Text.java index 902a39a..a4e5f59 100644 --- a/src/Text.java +++ b/src/Text.java @@ -25,6 +25,9 @@ public class Text { * @return returns true if the given paragraph exists and is added successfully */ public boolean add(int paragraphNumber, String text) { + if(text.length() < 1) { + return false; + } if (paragraphExists(paragraphNumber)) { this.text.add((paragraphNumber - 1), text); return true; @@ -39,6 +42,9 @@ public class Text { * @return returns true if the paragraph is added successfully */ public boolean add(String text) { + if(text.length() < 1) { + return false; + } this.text.add(text.replaceAll("[^A-Za-z0-9 .,:?!\"'-]","")); return true; }