Skip to content

Commit

Permalink
Should fix NPE on connection [JENKINS-22478]
Browse files Browse the repository at this point in the history
  • Loading branch information
kutzi committed Apr 2, 2014
1 parent cedaa05 commit 50754ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/hudson/plugins/ircbot/v2/IRCConnection.java
Expand Up @@ -110,7 +110,7 @@ public boolean connect() {
LOGGER.info(String.format("Connecting to %s:%s as %s using charset %s",
this.descriptor.getHost(), this.descriptor.getPort(), this.descriptor.getNick(), this.descriptor.getCharset()));

String password = Util.fixEmpty(this.descriptor.getPassword());
String socksHost = Util.fixEmpty(this.descriptor.getSocksHost());

final SocketFactory sf;
if (this.descriptor.isSsl()) {
Expand All @@ -119,12 +119,13 @@ public boolean connect() {
} else {
sf = SSLSocketFactory.getDefault();
}
} else if (!this.descriptor.getSocksHost().equals("") && this.descriptor.getSocksPort() > 0) {
} else if (socksHost != null && this.descriptor.getSocksPort() > 0) {
sf = new ProxySocketFactory(Proxy.Type.SOCKS, this.descriptor.getSocksHost(), this.descriptor.getSocksPort());
} else {
sf = SocketFactory.getDefault();
}

String password = Util.fixEmpty(this.descriptor.getPassword());
this.pircConnection.connect(this.descriptor.getHost(), this.descriptor.getPort(), password, sf);

LOGGER.info("connected to IRC");
Expand Down

0 comments on commit 50754ea

Please sign in to comment.