From af51ad69684604c46140e5e1a8b98d291c7978e3 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 4 May 2019 11:16:33 +0200 Subject: [PATCH] Prevent crash --- .../eu/faircode/email/AdapterMessage.java | 112 ++++++------------ 1 file changed, 39 insertions(+), 73 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 73dfb7ee6d..dea1e32b79 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -956,24 +956,15 @@ public class AdapterMessage extends RecyclerView.Adapter attachments) { @@ -1033,20 +1024,10 @@ public class AdapterMessage extends RecyclerView.Adapter() { @Override protected Void onExecute(Context context, Bundle args) { @@ -1732,24 +1698,30 @@ public class AdapterMessage extends RecyclerView.Adapter bodyTask = new SimpleTask() { @Override - protected SpannableStringBuilder onExecute(final Context context, final Bundle args) { + protected SpannableStringBuilder onExecute(final Context context, final Bundle args) throws IOException { DB db = DB.getInstance(context); final TupleMessageEx message = (TupleMessageEx) args.getSerializable("message"); final boolean show_images = args.getBoolean("show_images"); boolean show_quotes = args.getBoolean("show_quotes"); int zoom = args.getInt("zoom"); - String body; - try { - body = Helper.readText(message.getFile(context)); - } catch (IOException ex) { - Log.e(ex); - db.message().setMessageContent(message.id, false, null, null); - db.message().setMessageSize(message.id, null); - return null; - } + String body = Helper.readText(message.getFile(context)); if (!show_quotes) { Document document = Jsoup.parse(body); @@ -1901,13 +1873,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0) { properties.setValue("quotes", message.id, true); - - Bundle args = new Bundle(); - args.putSerializable("message", message); - args.putBoolean("show_images", show_images); - args.putBoolean("show_quotes", true); - args.putInt("zoom", zoom); - bodyTask.execute(context, owner, args, "message:body"); + showText(message); } }