mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Prevent crash when destroying GroupedCallLogData if lastCallLogViewModel wasn't created yet
This commit is contained in:
parent
90721a432b
commit
c4244804d8
1 changed files with 10 additions and 2 deletions
|
|
@ -27,10 +27,18 @@ class GroupedCallLogData(callLog: CallLog) {
|
|||
val callLogs = arrayListOf(callLog)
|
||||
val lastCallLogViewModel: CallLogViewModel
|
||||
get() {
|
||||
return CallLogViewModel(lastCallLog)
|
||||
if (::_lastCallLogViewModel.isInitialized) {
|
||||
return _lastCallLogViewModel
|
||||
}
|
||||
_lastCallLogViewModel = CallLogViewModel(lastCallLog)
|
||||
return _lastCallLogViewModel
|
||||
}
|
||||
|
||||
private lateinit var _lastCallLogViewModel: CallLogViewModel
|
||||
|
||||
fun destroy() {
|
||||
lastCallLogViewModel.destroy()
|
||||
if (::_lastCallLogViewModel.isInitialized) {
|
||||
lastCallLogViewModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue