Prevent crash

This commit is contained in:
M66B 2018-10-27 06:19:03 +00:00
parent 16e0b366b3
commit f602a6d687
1 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,11 @@ public class ItemKeyProviderMessage extends ItemKeyProvider<Long> {
@Override
public Long getKey(int pos) {
AdapterMessage adapter = (AdapterMessage) recyclerView.getAdapter();
return adapter.getCurrentList().get(pos).id;
PagedList<TupleMessageEx> list = adapter.getCurrentList();
if (list != null && pos < list.size())
return list.get(pos).id;
else
return null;
}
@Override