diff --git a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java index 249556f..620d0f6 100644 --- a/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java +++ b/src/main/java/com/cloudbees/syslog/sender/TcpSyslogMessageSender.java @@ -288,6 +288,8 @@ public String toString() { @Override public void close() throws IOException { - this.socket.close(); + if (socket != null) { + this.socket.close(); + } } }