From 33b3dc6eaa1325266ef00a040b5c53048c8c8187 Mon Sep 17 00:00:00 2001 From: Amir Wiener Date: Wed, 4 Jan 2023 23:49:23 +0200 Subject: [PATCH] prevent NPE in TcpSyslogMessageSender.close() --- .../com/cloudbees/syslog/sender/TcpSyslogMessageSender.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); + } } }