make API level request less crashy

This commit is contained in:
Andrew Dolgov 2011-12-13 15:54:01 +03:00
parent 48751a0071
commit 80a234cc15

View File

@ -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) {
try {
m_apiLevel = result.getAsJsonObject()
.get("level").getAsInt();
} else {
m_apiLevel = 0;
} catch (Exception e) {
e.printStackTrace();
}
}
Log.d(TAG, "Received API level: " + m_apiLevel);