1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

Fix crashes.

This commit is contained in:
Tom Hacohen 2020-11-08 17:17:43 +02:00
parent f382115128
commit 4485fdbb08

View File

@ -90,7 +90,7 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
override fun onLoadFinished(loader: Loader<AccountSettings>, settings: AccountSettings?) { override fun onLoadFinished(loader: Loader<AccountSettings>, settings: AccountSettings?) {
if (settings == null) { if (settings == null) {
activity!!.finish() activity?.finish()
return return
} }
// Category: dashboard // Category: dashboard
@ -107,12 +107,15 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
} }
} catch (e: EtebaseException) { } catch (e: EtebaseException) {
uiThread { uiThread {
AlertDialog.Builder(requireContext()) val context = context
.setIcon(R.drawable.ic_error_dark) if (context != null) {
.setTitle(R.string.exception) AlertDialog.Builder(context)
.setMessage(e.localizedMessage) .setIcon(R.drawable.ic_error_dark)
.setPositiveButton(android.R.string.yes) { _, _ -> } .setTitle(R.string.exception)
.show() .setMessage(e.localizedMessage)
.setPositiveButton(android.R.string.yes) { _, _ -> }
.show()
}
} }
} }
} }