From 34c2c311e28a6f33a559bab601e35045c2fb224c Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Mon, 3 Mar 2025 14:41:30 +0100 Subject: [PATCH] Fix NPE --- .../kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java index 5ada277d..a4dd42db 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java @@ -249,8 +249,12 @@ public class LanLinkProvider extends BaseLinkProvider { writer.write(myIdentity.serialize().getBytes(Charsets.UTF_8)); writer.flush(); BufferedReader reader = new BufferedReader(new InputStreamReader(sslSocket.getInputStream())); + String line = reader.readLine(); + if (line == null) { + throw new JSONException("Can't read line"); + } // Do not trust the identity packet we received unencrypted - secureIdentityPacket = NetworkPacket.unserialize(reader.readLine()); + secureIdentityPacket = NetworkPacket.unserialize(line); if (!DeviceInfo.isValidIdentityPacket(secureIdentityPacket)) { throw new JSONException("Invalid identity packet"); }