File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class CATInterpreter {
176176 void paintPattern (List <String > colors, String repetitions, String pattern) {
177177 final List <int > colorsParsed =
178178 colors.map ((String e) => containsColor (e.trim ()).index).toList ();
179- if (colorsParsed.contains (CatColors .NaC .index)) {
179+ if (colorsParsed.contains (CatColors .NaC .index) || colors.isEmpty ) {
180180 _error = CatError .invalidColor;
181181
182182 return ;
@@ -211,7 +211,7 @@ class CATInterpreter {
211211 void paintMultileCells (List <String > colors, List <String > cellsPositions) {
212212 final List <int > colorsParsed =
213213 colors.map ((String e) => containsColor (e.trim ()).index).toList ();
214- if (colorsParsed.contains (CatColors .NaC .index)) {
214+ if (colorsParsed.contains (CatColors .NaC .index) || colors.isEmpty ) {
215215 _error = CatError .invalidColor;
216216
217217 return ;
@@ -220,6 +220,11 @@ class CATInterpreter {
220220 final int row = _commandCaller.board.move.row;
221221 final StringBuffer newCommand = StringBuffer ();
222222 int j = 0 ;
223+ if (cellsPositions.isEmpty){
224+ _error = CatError .invalidCell;
225+
226+ return ;
227+ }
223228 for (final String i in cellsPositions) {
224229 newCommand
225230 ..write ("go($i )" )
You can’t perform that action at this time.
0 commit comments