Merge pull request #3756 from deltachat/r10s/fix-jsonrpc-crash

fix crash in JSONRPC
This commit is contained in:
adb
2025-05-05 14:31:54 +00:00
committed by GitHub
2 changed files with 8 additions and 3 deletions
+1
View File
@@ -3,6 +3,7 @@
## Unreleased
* fix: webxdc.selfName uses the name otherwise displayed
* fix potential crash on startup
## v1.58.2
2025-04
@@ -30,9 +30,13 @@ public class Rpc {
private void processResponse() throws JsonSyntaxException {
String jsonResponse = dcJsonrpcInstance.getNextResponse();
Response response = gson.fromJson(jsonResponse, Response.class);
if (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;
}
@@ -63,7 +67,7 @@ public class Rpc {
while (true) {
try {
processResponse();
} catch (JsonSyntaxException e) {
} catch (Exception e) {
e.printStackTrace();
}
}