Ensure that name is always != null.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / data / Network.java
index 8fac0ea..65a419f 100644 (file)
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.xdcc.data;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.Collection;
 
 import com.beust.jcommander.internal.Sets;
@@ -40,9 +42,11 @@ public class Network {
         *
         * @param name
         *              The name of the network
+        * @throws NullPointerException
+        *              if {@code name} is {@code null}
         */
-       private Network(String name) {
-               this.name = name;
+       private Network(String name) throws NullPointerException {
+               this.name = checkNotNull(name, "name must not be null");
        }
 
        //