Moved sanity check to make more sense
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 30 Jun 2019 13:12:36 +0000 (15:12 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 30 Jun 2019 13:12:36 +0000 (15:12 +0200)
net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVector.java

index 0bd5ae5..4d5365a 100644 (file)
@@ -23,10 +23,10 @@ public final class BitVector implements StrictLogicType<BitVector>, Iterable<Bit
 
        private BitVector(Bit[] bits)
        {
+               this.bits = Objects.requireNonNull(bits);// do this first to "catch" bits==null before the foreach loop
                for (Bit bit : bits)
                        if (bit == null)
                                throw new NullPointerException();
-               this.bits = Objects.requireNonNull(bits);
        }
 
        public static BitVector of(Bit... bits)