Skip to content

Commit ad2ec0a

Browse files
committed
Add null checks to TS3Config (fail fast)
1 parent 3bbe48f commit ad2ec0a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/github/theholywaffle/teamspeak3/TS3Config.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828

2929
import com.github.theholywaffle.teamspeak3.TS3Query.FloodRate;
30-
import com.github.theholywaffle.teamspeak3.api.ConnectionHandler;
30+
import com.github.theholywaffle.teamspeak3.api.reconnect.ConnectionHandler;
3131

3232
import java.util.logging.Level;
3333

@@ -42,6 +42,7 @@ public class TS3Config {
4242
private ConnectionHandler connectionHandler = ConnectionHandler.DISCONNECT;
4343

4444
public TS3Config setHost(String host) {
45+
if (host == null) throw new NullPointerException("host cannot be null!");
4546
this.host = host;
4647
return this;
4748
}
@@ -60,6 +61,7 @@ int getQueryPort() {
6061
}
6162

6263
public TS3Config setFloodRate(FloodRate rate) {
64+
if (rate == null) throw new NullPointerException("rate cannot be null!");
6365
this.floodRate = rate;
6466
return this;
6567
}
@@ -69,6 +71,7 @@ FloodRate getFloodRate() {
6971
}
7072

7173
public TS3Config setDebugLevel(Level level) {
74+
if (level == null) throw new NullPointerException("level cannot be null!");
7275
this.level = level;
7376
return this;
7477
}
@@ -112,6 +115,7 @@ int getCommandTimeout() {
112115
}
113116

114117
public TS3Config setConnectionHandler(ConnectionHandler connectionHandler) {
118+
if (connectionHandler == null) throw new NullPointerException("connectionHandler cannot be null!");
115119
this.connectionHandler = connectionHandler;
116120
return this;
117121
}

0 commit comments

Comments
 (0)