diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-11 11:57:13 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-11 11:59:19 +0200 |
| commit | ad1a053867bd83f71d82a62af5ae50acb11480e2 (patch) | |
| tree | 1617c1d62cb36d351dfac5c3136cc58faf8397ab /main/src/cgeo/geocaching/cgBase.java | |
| parent | 6a775b8c3381470ae31c0f618070bd4d3d269262 (diff) | |
| download | cgeo-ad1a053867bd83f71d82a62af5ae50acb11480e2.zip cgeo-ad1a053867bd83f71d82a62af5ae50acb11480e2.tar.gz cgeo-ad1a053867bd83f71d82a62af5ae50acb11480e2.tar.bz2 | |
Do not try to decode a JSON object from a null response
This should fix #656.
Diffstat (limited to 'main/src/cgeo/geocaching/cgBase.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 61fe434..5230583 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -1563,7 +1563,12 @@ public class cgBase { } try { - final JSONObject resp = new JSONObject(cgBase.getResponseData(response)); + final String rawResponse = cgBase.getResponseData(response); + if (rawResponse == null) { + Log.e(Settings.tag, "cgBase.loadLogsFromDetails: unable to read whole response"); + return; + } + final JSONObject resp = new JSONObject(rawResponse); if (!resp.getString("status").equals("success")) { Log.e(Settings.tag, "cgBase.loadLogsFromDetails: status is " + resp.getString("status")); return; |
