From c7b2e1c7b29066d84ea2317bd6f3e43659289341 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 18 Mar 2020 17:40:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/search/DiffCallBack.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/search/DiffCallBack.kt b/app/src/main/java/io/legado/app/ui/book/search/DiffCallBack.kt index d0c2f2973..999f2a941 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/DiffCallBack.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/DiffCallBack.kt @@ -50,8 +50,8 @@ class DiffCallBack(private val oldItems: List, private val newItems: override fun getChangePayload(oldItemPosition: Int, newItemPosition: Int): Any? { val payload = Bundle() - val newItem: SearchBook? = if ((newItemPosition >= 0) && (newItemPosition < newItems.size)) newItems[newItemPosition] else null - val oldItem: SearchBook? = if ((oldItemPosition >= 0) && (oldItemPosition < oldItems.size)) oldItems[oldItemPosition] else null + val newItem = newItems.getOrNull(newItemPosition) + val oldItem = oldItems.getOrNull(oldItemPosition) if (newItem == null) return payload if (oldItem?.name != newItem.name) { payload.putString("name", newItem.name)