mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Add isValid check to RealmChangeListener to prevent crashes on deleted objects
This commit is contained in:
parent
59d87df0ca
commit
37dc77cc3e
2 changed files with 5 additions and 4 deletions
|
@ -45,9 +45,11 @@ internal class RealmSendingEventsDataSource(
|
|||
private var frozenSendingTimelineEvents: RealmList<TimelineEventEntity>? = null
|
||||
|
||||
private val sendingTimelineEventsListener = RealmChangeListener<RealmList<TimelineEventEntity>> { events ->
|
||||
uiEchoManager.onSentEventsInDatabase(events.map { it.eventId })
|
||||
updateFrozenResults(events)
|
||||
onEventsUpdated(false)
|
||||
if (events.isValid) {
|
||||
uiEchoManager.onSentEventsInDatabase(events.map { it.eventId })
|
||||
updateFrozenResults(events)
|
||||
onEventsUpdated(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun start() {
|
||||
|
|
|
@ -2393,7 +2393,6 @@ class TimelineFragment @Inject constructor(
|
|||
.setCancelable(true)
|
||||
.setNegativeButton(R.string.action_not_now) { _, _ -> }
|
||||
.setPositiveButton(R.string.action_try_it_out) { _, _ ->
|
||||
timelineViewModel.onCleared() // We should first clear our viewModel
|
||||
threadsManager.enableThreadsAndRestart(it)
|
||||
}
|
||||
.show()
|
||||
|
|
Loading…
Reference in a new issue