mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Import: verify activity is not null when finishing import.
This is really just an ugly workaround for a crash. This whole thing needs to be redone. It's currently quite broken when it comes to lifecycle handling and a source for many issues.
This commit is contained in:
parent
84ab0cb16f
commit
cac34e6785
@ -18,6 +18,7 @@ import at.bitfire.ical4android.CalendarStorageException
|
||||
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
|
||||
import com.etesync.syncadapter.Constants.KEY_COLLECTION_INFO
|
||||
import com.etesync.syncadapter.R
|
||||
import com.etesync.syncadapter.log.Logger
|
||||
import com.etesync.syncadapter.model.CollectionInfo
|
||||
import com.etesync.syncadapter.resource.LocalCalendar
|
||||
import com.etesync.syncadapter.resource.LocalEvent
|
||||
@ -190,7 +191,13 @@ class LocalCalendarImportFragment : ListFragment() {
|
||||
}
|
||||
|
||||
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
||||
if (progressDialog.isShowing && !activity!!.isDestroyed) {
|
||||
val activity = activity
|
||||
if (activity == null) {
|
||||
Logger.log.warning("Activity is null on import.")
|
||||
return
|
||||
}
|
||||
|
||||
if (progressDialog.isShowing && !activity.isDestroyed) {
|
||||
progressDialog.dismiss()
|
||||
}
|
||||
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
||||
|
@ -24,6 +24,7 @@ import at.bitfire.vcard4android.ContactsStorageException
|
||||
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
|
||||
import com.etesync.syncadapter.Constants.KEY_COLLECTION_INFO
|
||||
import com.etesync.syncadapter.R
|
||||
import com.etesync.syncadapter.log.Logger
|
||||
import com.etesync.syncadapter.model.CollectionInfo
|
||||
import com.etesync.syncadapter.resource.LocalAddressBook
|
||||
import com.etesync.syncadapter.resource.LocalContact
|
||||
@ -124,7 +125,13 @@ class LocalContactImportFragment : Fragment() {
|
||||
}
|
||||
|
||||
override fun onPostExecute(result: ResultFragment.ImportResult) {
|
||||
if (progressDialog.isShowing && !activity!!.isDestroyed) {
|
||||
val activity = activity
|
||||
if (activity == null) {
|
||||
Logger.log.warning("Activity is null on import.")
|
||||
return
|
||||
}
|
||||
|
||||
if (progressDialog.isShowing && !activity.isDestroyed) {
|
||||
progressDialog.dismiss()
|
||||
}
|
||||
(activity as ResultFragment.OnImportCallback).onImportResult(result)
|
||||
|
Loading…
Reference in New Issue
Block a user