File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
ui-toolkit/src/main/kotlin/io/snabble/sdk/widgets/snabble/purchase/repository Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ internal class PurchasesRepositoryImpl(
3030 override fun success (receiptInfos : Array <ReceiptInfo >? ) {
3131 if (! continuation.isActive) return
3232
33- val purchases: List <Purchase > = receiptInfos.mapToPurchases(count)
33+ val purchases: List <Purchase > = receiptInfos? .mapToPurchases(count) ? : emptyList( )
3434 continuation.resume(purchases)
3535 }
3636
@@ -41,11 +41,8 @@ internal class PurchasesRepositoryImpl(
4141 }
4242 }
4343
44- private fun Array<ReceiptInfo>?.mapToPurchases (count : Int ): List <Purchase > {
45- val receiptInfoList = this ?.toList()?.filter { it.pdfUrl != null } ? : emptyList()
46- if (receiptInfoList.isEmpty()) return emptyList()
47- return receiptInfoList
48- .slice(0 until receiptInfoList.size.coerceAtMost(count))
44+ private fun Array<ReceiptInfo>.mapToPurchases (count : Int ): List <Purchase > =
45+ this .filter { it.pdfUrl != null }
46+ .slice(0 until size.coerceAtMost(count))
4947 .map { it.toPurchase(timeFormatter) }
50- }
5148}
You can’t perform that action at this time.
0 commit comments