Skip to content

Commit d0aede2

Browse files
committed
Make LoadingItem assertion an optional type
Because the placeholder can be null (e.g. when scrolling the post list very quickly), the assertion will crash unless the asserted type is optional. This crash will not happen in production, since we already guard with a `?.let`. This fix prevents the crash in development.
1 parent 09a3984 commit d0aede2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

WordPress/src/main/java/org/wordpress/android/ui/posts/adapters/PostListAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class PostListAdapter(
9595
}
9696
if (holder is LoadingViewHolder) {
9797
val item = getItem(position)
98-
assert(item is LoadingItem) {
98+
assert(item is LoadingItem?) {
9999
"If we are presenting LoadingViewHolder, the item has to be of type LoadingItem " +
100100
"for position: $position"
101101
}

0 commit comments

Comments
 (0)