diff --git a/src/TextOutput.java b/src/TextOutput.java index 4b5c46e..2d32977 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -14,7 +14,10 @@ public class TextOutput { * @param text the ArrayList which is then formatted into the desired output. */ public void print(ArrayList text) { - if (formatRaw) { + if(text.size() == 0) { + errorMissingText(); + } + else if (formatRaw) { printFormated(text); } else { toFormat(text); @@ -112,8 +115,13 @@ public class TextOutput { * @param index ArrayList with words and in which part they have */ public void indexOutput(ArrayList index) { - for (String word : index) { - System.out.println(word); + if(index.size() == 0) { + errorMissingText(); + } + else { + for (String word : index) { + System.out.println(word); + } } } @@ -130,4 +138,11 @@ public class TextOutput { public void errorInvalidCommand() { System.err.println("Invalid Command"); } + + /** + * Method to give out the Error "Missing Text". + */ + public void errorMissingText() { + System.err.println("Missing Text"); + } }