mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
BIT-2443: Fix crash caused by extra blank spaces in name (#3395)
This commit is contained in:
parent
bb6a7af423
commit
ba95a53ebf
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ import java.util.Locale
|
|||
*/
|
||||
val AccountSummary.initials: String
|
||||
get() {
|
||||
val names = this.name.orEmpty().split(" ")
|
||||
val names = this.name.orEmpty().split(" ").filter { it.isNotBlank() }
|
||||
return if (names.size >= 2) {
|
||||
names
|
||||
.take(2)
|
||||
|
|
|
@ -12,7 +12,7 @@ class AccountSummaryExtensionsTest {
|
|||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `initials should return the starting letters of the first two words for a multi-word name`() {
|
||||
fun `initials should return the starting letters of the first two words for a multi-word name and ignore any extra spaces`() {
|
||||
assertEquals(
|
||||
"FS",
|
||||
mockk<AccountSummary> {
|
||||
|
|
Loading…
Reference in a new issue