empty check on mediaList
This commit is contained in:
parent
33bfbd65fb
commit
38a27c45a1
1 changed files with 9 additions and 10 deletions
|
@ -300,17 +300,16 @@ class MediaAdaptor(
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
fun randomOptionClick() { //used for user list
|
fun randomOptionClick() {
|
||||||
val media = mediaList?.random()
|
val media = if (!mediaList.isNullOrEmpty()) {
|
||||||
if (media != null) {
|
mediaList.random()
|
||||||
mediaList?.let {
|
} else {
|
||||||
clicked(
|
null
|
||||||
it.indexOf(media),
|
}
|
||||||
null
|
media?.let {
|
||||||
)
|
val index = mediaList?.indexOf(it) ?: -1
|
||||||
}
|
clicked(index, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class MediaViewHolder(val binding: ItemMediaCompactBinding) :
|
inner class MediaViewHolder(val binding: ItemMediaCompactBinding) :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue