fix crash when Account.displayName is null (#1667)
This commit is contained in:
parent
fde23f25d2
commit
88b8eca16a
4 changed files with 5 additions and 5 deletions
|
@ -458,7 +458,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
|||
|
||||
loadAvatar(movedAccount.avatar, accountMovedAvatar, avatarRadius, animateAvatar)
|
||||
|
||||
accountMovedText.text = getString(R.string.account_moved_description, movedAccount.displayName)
|
||||
accountMovedText.text = getString(R.string.account_moved_description, movedAccount.name)
|
||||
|
||||
// this is necessary because API 19 can't handle vector compound drawables
|
||||
val movedIcon = ContextCompat.getDrawable(this, R.drawable.ic_briefcase)?.mutate()
|
||||
|
|
|
@ -166,7 +166,7 @@ fun Account.toEntity() =
|
|||
ConversationAccountEntity(
|
||||
id,
|
||||
username,
|
||||
displayName,
|
||||
displayName.orEmpty(),
|
||||
avatar,
|
||||
emojis ?: emptyList()
|
||||
)
|
||||
|
|
|
@ -31,7 +31,7 @@ data class Account(
|
|||
val id: String,
|
||||
@SerializedName("username") val localUsername: String,
|
||||
@SerializedName("acct") val username: String,
|
||||
@SerializedName("display_name") val displayName: String,
|
||||
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
|
||||
val note: @WriteWith<SpannedParceler>() Spanned,
|
||||
val url: String,
|
||||
val avatar: String,
|
||||
|
@ -49,7 +49,7 @@ data class Account(
|
|||
) : Parcelable {
|
||||
|
||||
val name: String
|
||||
get() = if (displayName.isEmpty()) {
|
||||
get() = if (displayName.isNullOrEmpty()) {
|
||||
localUsername
|
||||
} else displayName
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ fun Account.toEntity(accountId: Long, gson: Gson): TimelineAccountEntity {
|
|||
timelineUserId = accountId,
|
||||
localUsername = localUsername,
|
||||
username = username,
|
||||
displayName = displayName,
|
||||
displayName = displayName.orEmpty(),
|
||||
url = url,
|
||||
avatar = avatar,
|
||||
emojis = gson.toJson(emojis),
|
||||
|
|
Loading…
Reference in a new issue