mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 17:59:39 +02:00
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:
parent
501a77e1dc
commit
bc72fce060
1 changed files with 2 additions and 2 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue