fix(StatusDisplayItem/Quote): only update non-empty adapter
Fixes a crash when updating an empty adapter. This was the case when opening a status from a notification.
This commit is contained in:
@@ -722,7 +722,9 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||||||
assert this instanceof StatusListFragment;
|
assert this instanceof StatusListFragment;
|
||||||
List<StatusDisplayItem> items=((StatusListFragment) this).buildDisplayItems(status);
|
List<StatusDisplayItem> items=((StatusListFragment) this).buildDisplayItems(status);
|
||||||
displayItems.subList(startIndex, endIndex+1).clear();
|
displayItems.subList(startIndex, endIndex+1).clear();
|
||||||
|
boolean isEmpty=displayItems.isEmpty();
|
||||||
displayItems.addAll(startIndex, items);
|
displayItems.addAll(startIndex, items);
|
||||||
|
if(!isEmpty)
|
||||||
adapter.notifyItemRangeChanged(startIndex, items.size());
|
adapter.notifyItemRangeChanged(startIndex, items.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user