[F] mai2: Error when rival list empty

pull/50/head
Clansty 2024-08-05 21:15:32 +08:00
parent 473f4a4295
commit 9ef0d0edfb
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ class Maimai2(
if (u.username == username) return@auth null if (u.username == username) return@auth null
us.cardByName(u.username) { myCard -> us.cardByName(u.username) { myCard ->
val user = repos.userData.findByCardExtId(card.extId).orElse(null) ?: (404 - "User not found") val user = repos.userData.findByCardExtId(card.extId).orElse(null) ?: (404 - "User not found")
val myRival = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival").map { it.propertyValue.split(',') }.orElse(emptyList()).map { it.long() } val myRival = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival")
.map { it.propertyValue.split(',') }.orElse(emptyList()).filter { it.isNotEmpty() }.map { it.long() }
myRival.contains(user.id) myRival.contains(user.id)
} }
} }