From 45379870b1dfc0f8042faea6ebd3a1672f4882c5 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 28 Jul 2019 14:02:01 +0200 Subject: [PATCH] Salvage draft in case of errors This is know to happen due to "Exception while computing database live data" --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 3231463851..39e94fd4e6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2614,7 +2614,10 @@ public class FragmentCompose extends FragmentBase { null); } } else { - String previous = Helper.readText(draft.getFile(context)); + File file = draft.getFile(context); + if (!file.exists()) + Helper.writeText(file, body); + String previous = Helper.readText(file); if (!body.equals(previous) || plain_only != (draft.plain_only != null && draft.plain_only)) { dirty = true;