File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,14 +71,17 @@ String parseGeneralCommand(String input) throws DukeIncompleteCommandException {
7171 return taskList .listString ();
7272 } else if (input .contains ("done" )) {
7373 inputs = input .split (" " );
74+ assert (inputs [1 ] != "" ) : "No index found!" ;
7475 index = Integer .parseInt (inputs [1 ]) - 1 ;
7576 return taskList .markDone (index );
7677 } else if (input .contains ("delete" )) {
7778 inputs = input .split (" " );
79+ assert (inputs [1 ] != "" ) : "No index found!" ;
7880 index = Integer .parseInt (inputs [1 ]) - 1 ;
7981 return taskList .delete (index );
8082 } else {
8183 inputs = input .split (" " );
84+ assert (inputs [1 ] != "" ) : "No index found!" ;
8285 String keyword = inputs [1 ];
8386 return taskList .find (keyword );
8487 }
@@ -97,6 +100,7 @@ public static Task parseAddTaskCommand(String input) throws DukeIncompleteComman
97100 TimedTask timedTask = new TimedTask ();
98101 String editedInput ;
99102 String regex ;
103+ assert (input .contains (" " ) : "Space between command and task needed!" ;
100104 if (input .contains ("todo" )) {
101105 editedInput = input .substring (4 ).trim ();
102106 regex = "" ;
You can’t perform that action at this time.
0 commit comments