From 6786358082b5faabc67808a580d448ca9fc0c578 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 30 Sep 2018 15:23:17 +0000 Subject: [PATCH] Fixed potential crash --- app/src/main/java/eu/faircode/email/FragmentMessages.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 275f6f8f..df5257dc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -182,7 +182,7 @@ public class FragmentMessages extends FragmentEx { return 0; TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos); - if (message.threaded || EntityFolder.OUTBOX.equals(message.folderType)) + if (message == null || message.threaded || EntityFolder.OUTBOX.equals(message.folderType)) return 0; return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT); @@ -200,6 +200,9 @@ public class FragmentMessages extends FragmentEx { return; TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos); + if (message == null) + return; + boolean inbox = (EntityFolder.ARCHIVE.equals(message.folderType) || EntityFolder.TRASH.equals(message.folderType)); View itemView = viewHolder.itemView; @@ -237,6 +240,8 @@ public class FragmentMessages extends FragmentEx { return; TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos); + if (message == null) + return; Log.i(Helper.TAG, "Swiped dir=" + direction + " message=" + message.id); Bundle args = new Bundle();