mirror of
https://github.com/etesync/android
synced 2025-01-08 23:01:09 +00:00
ViewCollection: fix crash when clicking options while still loading.
This commit is contained in:
parent
eb09c3a0e0
commit
8a9161301e
@ -4,6 +4,7 @@ import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
@ -108,7 +109,11 @@ class ViewCollectionFragment : Fragment() {
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
val cachedCollection = collectionModel.value!!
|
||||
val cachedCollection = collectionModel.value
|
||||
if (cachedCollection == null) {
|
||||
Toast.makeText(context, R.string.loading_error_title, Toast.LENGTH_LONG).show()
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
when (item.itemId) {
|
||||
R.id.on_edit -> {
|
||||
|
Loading…
Reference in New Issue
Block a user