crash fixed

This commit is contained in:
Gavriil Sitnikov 2016-07-27 11:36:24 +03:00
parent 582c7ff9dd
commit 80f95dc9f7
1 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ public abstract class ObservableCollectionAdapter<TItem, TViewHolder extends Obs
innerCollection.observeChanges().subscribe(this::onItemsChanged);
lifecycleBindable.untilDestroy(observableCollectionSubject
.doOnNext(collection -> innerCollection.set(collection != null ? collection.getItems() : new ArrayList<>()))
.switchMap(observableCollection -> observableCollection != null
.<ObservableCollection.CollectionChange<TItem>>switchMap(observableCollection -> observableCollection != null
? observableCollection.observeChanges().observeOn(AndroidSchedulers.mainThread())
: Observable.empty()),
changes -> {
@ -252,7 +252,7 @@ public abstract class ObservableCollectionAdapter<TItem, TViewHolder extends Obs
@Nullable
public TItem getItem(final int position) {
final int positionInList = position - getHeadersCount();
return positionInList >= innerCollection.size() ? null : innerCollection.get(positionInList);
return positionInList < 0 || positionInList >= innerCollection.size() ? null : innerCollection.get(positionInList);
}
@Override