Browse Source

Ajout exeception si création ConsListImpl vide

Arthur Brandao 6 years ago
parent
commit
5daa6d0cf8
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/migl/util/ConsListImpl.java

+ 3 - 0
src/migl/util/ConsListImpl.java

@@ -9,6 +9,9 @@ public class ConsListImpl<E> extends Cons<E, ConsList<E>> implements ConsList<E>
 
 	public ConsListImpl(E left, ConsList<E> right) {
 		super(left, right);
+		if(right == null) {
+			throw new IllegalArgumentException();
+		}
 		this.size = 1 + right.size();
 	}