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.
This commit is contained in:
B. Petersen 2025-05-03 20:39:05 +02:00
parent 501a77e1dc
commit bc72fce060

View file

@ -32,7 +32,7 @@ public class Rpc {
String jsonResponse = dcJsonrpcInstance.getNextResponse(); String jsonResponse = dcJsonrpcInstance.getNextResponse();
Response response = gson.fromJson(jsonResponse, Response.class); 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; return;
} }
@ -63,7 +63,7 @@ public class Rpc {
while (true) { while (true) {
try { try {
processResponse(); processResponse();
} catch (JsonSyntaxException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }