log error if JSONRPC fails

This commit is contained in:
B. Petersen 2025-05-05 13:36:25 +02:00
parent 8f2b761361
commit 17e45fd2ab

View file

@ -30,9 +30,13 @@ public class Rpc {
private void processResponse() throws JsonSyntaxException { private void processResponse() throws JsonSyntaxException {
String jsonResponse = dcJsonrpcInstance.getNextResponse(); String jsonResponse = dcJsonrpcInstance.getNextResponse();
Response response = gson.fromJson(jsonResponse, Response.class);
if (response == null || response.id == 0) { // Got JSON-RPC notification/event, ignore Response response = gson.fromJson(jsonResponse, Response.class);
if (response == null) {
Log.e(TAG, "Error parsing JSON: " + jsonResponse);
return;
} else if (response.id == 0) {
// Got JSON-RPC notification/event, ignore
return; return;
} }