From f602a6d687b6d66ed1c8f0505c0500fed0306e69 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 27 Oct 2018 06:19:03 +0000 Subject: [PATCH] Prevent crash --- .../main/java/eu/faircode/email/ItemKeyProviderMessage.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ItemKeyProviderMessage.java b/app/src/main/java/eu/faircode/email/ItemKeyProviderMessage.java index c2c80954..81c9e54d 100644 --- a/app/src/main/java/eu/faircode/email/ItemKeyProviderMessage.java +++ b/app/src/main/java/eu/faircode/email/ItemKeyProviderMessage.java @@ -18,7 +18,11 @@ public class ItemKeyProviderMessage extends ItemKeyProvider { @Override public Long getKey(int pos) { AdapterMessage adapter = (AdapterMessage) recyclerView.getAdapter(); - return adapter.getCurrentList().get(pos).id; + PagedList list = adapter.getCurrentList(); + if (list != null && pos < list.size()) + return list.get(pos).id; + else + return null; } @Override