mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-15 18:48:52 +01:00
Fix crash when attempting to save draft for invalid conversation
This commit is contained in:
@@ -141,14 +141,14 @@ class ConversationRepositoryImpl @Inject constructor(
|
||||
|
||||
override fun saveDraft(threadId: Long, draft: String) {
|
||||
Realm.getDefaultInstance().use { realm ->
|
||||
realm.refresh()
|
||||
|
||||
val conversation = realm.where(Conversation::class.java)
|
||||
.equalTo("id", threadId)
|
||||
.findFirst()
|
||||
|
||||
conversation?.let {
|
||||
realm.executeTransaction {
|
||||
conversation.draft = draft
|
||||
}
|
||||
realm.executeTransaction {
|
||||
conversation?.takeIf { it.isValid }?.draft = draft
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user