diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetClientThread.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetClientThread.java index 0b4747271759d..5b5d34a3ac61d 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetClientThread.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetClientThread.java @@ -20,6 +20,7 @@ import java.net.Socket; import java.net.SocketTimeoutException; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +49,7 @@ public class DenonMarantzTelnetClientThread extends Thread { private OutputStreamWriter out; - private BufferedReader in; + private @Nullable BufferedReader in; public DenonMarantzTelnetClientThread(DenonMarantzConfiguration config, DenonMarantzTelnetListener listener) { logger.debug("Denon listener created"); @@ -65,7 +66,10 @@ public void run() { do { try { - String line = in.readLine(); + String line = null; + if (in != null) { + line = in.readLine(); + } if (line == null) { logger.debug("No more data read from client. Disconnecting.."); listener.telnetClientConnected(false);