Fix #759 , a crash when the artist name was empty.

This commit is contained in:
tzugen 2022-06-20 10:12:45 +02:00
parent 5deb7d4d58
commit 46a8f4640d
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
1 changed files with 7 additions and 2 deletions

View File

@ -102,8 +102,9 @@ class ArtistRowBinder(
}
private fun getSectionFromName(name: String): String {
var section = name.first().uppercaseChar()
if (!section.isLetter()) section = '#'
if (name.isEmpty()) return SECTION_KEY_DEFAULT
val section = name.first().uppercaseChar()
if (!section.isLetter()) return SECTION_KEY_DEFAULT
return section.toString()
}
@ -123,4 +124,8 @@ class ArtistRowBinder(
override fun onCreateViewHolder(inflater: LayoutInflater, parent: ViewGroup): ViewHolder {
return ViewHolder(inflater.inflate(layout, parent, false))
}
companion object {
const val SECTION_KEY_DEFAULT = "#"
}
}