From 80a234cc15fb1e5dba088a17b3876bc62b8a7c0d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 13 Dec 2011 15:54:01 +0300 Subject: [PATCH] make API level request less crashy --- src/org/fox/ttrss/MainActivity.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 6bc7a5ce..d7bdabe5 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -1212,11 +1212,15 @@ public class MainActivity extends FragmentActivity implements OnlineServices { ApiRequest req = new ApiRequest(m_context) { protected void onPostExecute(JsonElement result) { + m_apiLevel = 0; + if (result != null) { - m_apiLevel = result.getAsJsonObject() - .get("level").getAsInt(); - } else { - m_apiLevel = 0; + try { + m_apiLevel = result.getAsJsonObject() + .get("level").getAsInt(); + } catch (Exception e) { + e.printStackTrace(); + } } Log.d(TAG, "Received API level: " + m_apiLevel);