Merge pull request #761 from ultrasonic/fix_#759

Fix #759 , a crash when the artist name was empty.
This commit is contained in:
Óscar García Amor authored and GitHub committed 2022-06-21 08:52:54 +02:00
commit ff9c7b2435
1 file changed
+7 -2
@@ -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 = "#"
}
}