fix IndexOutOfBoundException caused by ListStatusAccessibilityDelegate (#1178)

This commit is contained in:
Konrad Pozniak 2019-04-07 16:32:58 +02:00 committed by GitHub
commit dd02af9911
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package com.keylesspalace.tusky.util;
import androidx.annotation.Nullable;
import androidx.arch.core.util.Function;
import java.util.AbstractList;
@ -44,6 +45,15 @@ public final class PairedList<T, V> extends AbstractList<T> {
return synced.get(index);
}
@Nullable
public V getPairedItemOrNull(int index) {
if (index >= 0 && index < synced.size()) {
return synced.get(index);
} else {
return null;
}
}
public void setPairedItem(int index, V element) {
synced.set(index, element);
}