From bc72fce060d6c8423e2cbbb278227dfd97983f62 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 3 May 2025 20:39:05 +0200 Subject: [PATCH] fix crash in JSONRPC the fix could have been avoid by checking for null or not being overly specific with the exception. as this is a very sensible area, where any failure is dramatic, we do both. --- src/main/java/com/b44t/messenger/rpc/Rpc.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/b44t/messenger/rpc/Rpc.java b/src/main/java/com/b44t/messenger/rpc/Rpc.java index ed6d02b0b..f5bf4401b 100644 --- a/src/main/java/com/b44t/messenger/rpc/Rpc.java +++ b/src/main/java/com/b44t/messenger/rpc/Rpc.java @@ -32,7 +32,7 @@ public class Rpc { String jsonResponse = dcJsonrpcInstance.getNextResponse(); Response response = gson.fromJson(jsonResponse, Response.class); - if (response.id == 0) { // Got JSON-RPC notification/event, ignore + if (response == null || response.id == 0) { // Got JSON-RPC notification/event, ignore return; } @@ -63,7 +63,7 @@ public class Rpc { while (true) { try { processResponse(); - } catch (JsonSyntaxException e) { + } catch (Exception e) { e.printStackTrace(); } }