From f5b38bd806ba65a0c933da9cbf45db1914cfcd81 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 14 Sep 2018 16:58:30 +0000 Subject: [PATCH] Prevent crash --- .idea/misc.xml | 2 +- app/src/main/java/eu/faircode/email/ActivityView.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index caad359b..77d47004 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -30,7 +30,7 @@ - + diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 940558b0..877c0a7c 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -32,6 +32,7 @@ import android.os.Build; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.preference.PreferenceManager; +import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; @@ -503,14 +504,20 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB prefs.edit().putLong("last_update_check", now).apply(); UpdateInfo info = new UpdateInfo(); + info.tag_name = jroot.getString("tag_name"); info.html_url = jroot.getString("html_url"); + if (TextUtils.isEmpty(info.html_url)) + return null; + JSONArray jassets = jroot.getJSONArray("assets"); for (int i = 0; i < jassets.length(); i++) { JSONObject jasset = jassets.getJSONObject(i); if (jasset.has("name")) { String name = jasset.getString("name"); if (name != null && name.endsWith(".apk")) { - info.tag_name = jroot.getString("tag_name"); + if (TextUtils.isEmpty(info.tag_name)) + info.tag_name = name; + Log.i(Helper.TAG, "Latest version=" + info.tag_name); if (BuildConfig.VERSION_NAME.equals(info.tag_name)) break;